[mocha-developer] Expect with "real world" returns?
Carl Mercier
carl at carlmercier.com
Wed May 21 10:56:40 EDT 2008
I wish Mocha supported this "out of the box" with this syntax:
User.expects(:find).with(1) # returns the "real" row from the
database
User.expects(:find).with(1).returns(mocked_row) # returns a fake row
and to have something explicitly return nil (without running the real
code):
Foo.expects(:bar).returns(nil)
It's probably too late to change the way .expects work right now,
however.
/c
On 20-May-08, at 5:55 PM, Duncan Beevers wrote:
> Brian Takita discusses this functionality in his RR mocking framework
> under the moniker Mock Proxy.
>
> http://pivots.pivotallabs.com/users/brian/blog/articles/352-introducing-rr
>
> Not sure if I've posted to this about the pattern before, but it looks
> really useful, especially if it could be combined with traditional
> mocking techniques.
More information about the mocha-developer
mailing list