[mocha-developer] Expect with "real world" returns?
carl at carlmercier.com
Wed May 21 16:35:21 EDT 2008
I think you missed my point. I -do- want the real database row, but I
also want to make sure that the "find" method is called with the right
parameters and x number of times.
So this is not really mocking, just setting expectations about what
will be called and with what arguments.
On 21-May-08, at 4:32 PM, Zach Moazeni wrote:
> On May 21, 2008, at 10:56 AM, Carl Mercier wrote:
>> I wish Mocha supported this "out of the box" with this syntax:
>> User.expects(:find).with(1) # returns the "real" row from the
>> User.expects(:find).with(1).returns(mocked_row) # returns a fake row
> In my opinion, I don't find that useful. If I want the real row from
> the database to brought in, I wouldn't use mocking. I only use
> expects / stubs when I want to alter and/or assert behavior.
>> and to have something explicitly return nil (without running the
>> real code):
> I'm too lazy to check right now, but I thought that was the current
> Foo.bar => nil
> mocha-developer mailing list
> mocha-developer at rubyforge.org
More information about the mocha-developer