更新到 Rails 3.2.6 或 Rspec 2.11.0 时出现路由错误 [英] Routing error when updating to Rails 3.2.6 or Rspec 2.11.0
问题描述
升级到 Rails 3.2.6 或 Rspec 2.11.0 后,我的规范开始显示如下路由错误:
After upgrading to Rails 3.2.6 or Rspec 2.11.0, my specs starts to show routing errors like the following:
4) UsersController GET activate activation code not exist
Failure/Error: subject{ get :activate }
ActionController::RoutingError:
No route matches {:controller=>"users", :action=>"activate"}
每个钩子后面还有一个错误
There is also a after each hook error
An error occurred in an after(:each) hook
RSpec::Mocks::MockExpectationError: (#<EmailSubscriber[...]>).update_attributes({:enable=>true})
expected: 1 time
received: 0 times
occurred at [...]/spec/controllers/users_controller_spec.rb:75:in `block (3 levels) in <top (required)>'
开发模式下的应用程序仍然运行良好.
The application in development mode still runs fine.
推荐答案
Rspec 2.11.0 和 Rails 3.2.6 都使用最新的 Journey gem (1.0.4).它有一些问题,通过显式锁定到以前的版本,规范错误消失了.
Both Rspec 2.11.0 and Rails 3.2.6 uses the latest Journey gem (1.0.4). It has some problems, and by explictly lock it to the previous version the spec error disappears.
gem 'journey', '1.0.3'
更新
我最近使用 Journey 1.0.4 将 Rails 更新到 3.2.11,并且所有规范都通过了.我的 Rspec 是 2.11.0因此,无需再下载旅程,只需更新 Rails.
I recently updated Rails to 3.2.11 with Journey 1.0.4, and all spec passed. My Rspec is 2.11.0 Therefore there is no need to downlock journey anymore, just update Rails.
这篇关于更新到 Rails 3.2.6 或 Rspec 2.11.0 时出现路由错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!