how to test params passed into a controller in rails 3, using rspec?
get :show, {:id => subcategory.id.to_s, :params => {:sort => 'title'}}
Should be
get :show, :id => subcategory.id.to_s, :sort => 'title'
Unless you mean to pass params[:params][:sort]
.
Also
helper.params[:sort].should_not be_nil
Should be
controller.params[:sort].should_not be_nil
controller.params[:sort].should eql 'title'
(If you mean to test a helper, you should write a helper spec.)
With Rails 5 the params API changed:
get :show, params: { id: subcategory.id.to_s, sort: 'title' }
https://relishapp.com/rspec/rspec-rails/v/3-7/docs/request-specs/request-spec#specify-managing-a-widget-with-rails-integration-methods