Justin Funk
2012-Apr-18 14:06 UTC
[rspec-users] Testing parameter passed to controller new method (undefined method ''stringify_keys'')
I''m trying to test passing a parameter to the new method of my controller and am coming up with the "undefined method ''stringify_keys''" error when I use this code: get "new", { :company_id => ''1'' } I have seen other solutions to this issue, but they have all centered around the create method and either using FactoryGirl.attributes_for or making a deeper hash like { :object => { :company_id => 1 } }. I don''t think either of these solutions are appropriate. The logic I''m using involves CanCan, where I don''t want the user to be able to load up the ''new'' page unless they''ve got a valid company id. If the only way to do what I want really is to use the full object hash, then I need an update for my view test which is validating the new link, currently like so: rendered.should have_selector ''a'', :content => ''Add Object'', :href => ''/menus/new?company_id='' + company.id.to_s I''m using Rails 3.2.3 and rspec 2.9 -- Posted via http://www.ruby-forum.com/.