Notre code:
describe "GET show" do
it "assigns the requested subcategory as @subcategory" do
subcategory = Subcategory.create! valid_attributes
get :show, :id => subcategory.id.to_s
assigns(:subcategory).should eq(subcategory)
end
it "has a sort parameter in the url" do
subcategory = Subcategory.create! valid_attributes
get :show, {:id => subcategory.id.to_s, :params => {:sort => 'title'}}
helper.params[:sort].should_not be_nil
end
end
J'ai eu le message d'erreur suivant:
1) SubcategoriesController GET show has a sort parameter in the url
Failure/Error: helper.params[:sort].should_not be_nil
NameError:
undefined local variable or method `helper' for #<RSpec::Core::ExampleGroup::Nested_4::Nested_2:0x007f81a467c848>
# ./spec/controllers/subcategories_controller_spec.rb:54:in `block (3 levels) in <top (required)>'
Comment puis-je tester les params dans rspec?