lancecarlson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-21 00:26 UTC
Rspec and stubbing arrays
I''m having a little problem figuring out how to stub this scenario: my controller has this code in it: if current_user.foos << @foo and my spec is giving me errors about a missing stub: Mock ''foos'' received unexpected message :<< with <TheFooObject> Also related to this issue, I''m using mock_model but it''s not pulling in the methods from the model I''ve specified and I have to specify every single stub that I want to use. Is this normal behavior? Anyway, I also tried to do @user = mock_model(User) @user.foos.stub!(:<<).and_return([]) which still gave me the same dreadful error. Can anyone assist me with my two problems? TIA -L --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---