[rspec-users] how to mock/stub when there are multiple model objects?

S Ahmed sahmed1020 at gmail.com
Fri Jun 17 19:17:45 EDT 2011

I'm a bit confused how to hook into a particular model object instance and
mock/stub it?

I understand how to hook into a class level method like:


but what if my method looks like:

def some_thing

   user = User.where("...")

   user2 = User.where("...")




How can I hook into one or both model instances of 'user' and 'user2' at the
same time in the same test?

Or is it only possible to do it one at a time?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110617/5714626a/attachment.html>

More information about the rspec-users mailing list