[rspec-users] RSpec 2: what should I replace 'params_from' with?

Ivo Wever lists at ruby-forum.com
Thu Jun 24 04:05:29 EDT 2010


Hey,

I'm migrating an app to Rails 3 + RSpec 2 and, as expected, a number of
specs broke. Unfortunately, I can't really find how to fix them. For
instance, there is a spec:

describe SessionsController do
  describe "route recognition" do
    it "should generate params from GET /login correctly" do
      params_from(:get, '/login').should ==
        {:controller => 'sessions', :action => 'new'}
    end
end

This spec is located in Rails.root +
/spec/controllers/sessions_controller_spec.rb

The error is:

SessionsController route recognition should generate params from POST
/session correctly
    Failure/Error: params_from(:post, '/session').should == {:controller
=> 'sessions', :action => 'create'}
    undefined method `params_from' for
#<RSpec::Core::ExampleGroup::Nested_15::Nested_2:0x458d348>
    #
./vendor/gems/actionpack-3.0.0.beta4/lib/action_dispatch/testing/assertions/routing.rb:175:in
`method_missing'
    # ./spec/controllers/sessions_controller_spec.rb:121


Also note the 'RSpec::Core::ExampleGroup': it seems like it doesn't
correctly infer it should be RSpec::Rails::ControllerExampleGroup?
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list