Guofeng Ma
2008-Oct-09 09:05 UTC
what''s diffrence between ({:these=>"params"}) and ({"these"
When i use rspec(with built-in mock framework) ,error occurs. I use rspec_scaffold generate a example as below: it "should expose a newly created awarding_body as @awarding_body" do AwardingBody.should_receive(:new).with(:these =>''params'').and_return(mock_awarding_body(:save => true)) post :create, :awarding_body => {:these => ''params''} assigns(:awarding_body).should == (mock_awarding_body) end After execute the example , a error occurs as below : Mock ''Class'' expected :new with ({:these=>"params"}) but received it with ({"the se"=>"params"}) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Oct-09 09:08 UTC
Re: what''s diffrence between ({:these=>"params"}) and ({"these"
On 9 Oct 2008, at 10:05, Guofeng Ma wrote:> > Mock ''Class'' expected :new with ({:these=>"params"}) but received it > with ({"the > se"=>"params"})Probably because actioncontroller magics the params hash into a hash with string keys, not symbol keys. Fred> > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---