ruby-on-rails-3rspecjourney

Routing error when updating to Rails 3.2.6 or 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.


Solution

  • 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'
    

    UPDATE

    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.