[mocha-developer] Mocha

James Mead jamesmead44 at gmail.com
Tue Jan 2 11:58:08 EST 2007

On 31/12/06, Tobias Lütke <tobias.luetke at gmail.com> wrote:
> I just replaced various homegrown stubbing and mocking facilities in
> Shopify and wanted to let you know my appreciation for this fantastic
> library of yours. I love the user interface and the internal code is
> something to behold as well.

Thanks - I'm glad you've found it useful. It's encouraging to hear that you
think the internal code is in good shape. I was starting to think it had
deteriorated quite a bit!

Attached is a tiny patch which reverses the order in which
> Expectations are run. In shopify we use a global directory under
> test/mocks which registers a bunch of global stubs for external
> services ( Solr, Memcached, Auth.net, Paypal express and so on) but
> some test cases need to undo the global stubbing or replace it with
> different return values. Running expectations in reverse means that
> the most recent registered stub will be run and not the first one
> registered.
> I'm not 100% sold on this solution. Maybe it would be better to write
> a proper Comparable implementation for the Expectation class and then
> call uniq! on expectations at various times because the way i did it
> now would surely not work with expects().

Many thanks for the patch. It's been something on the todo list for quite a
while. But you'll be pleased to hear I've just applied it (revision 75).

I'm happy with your supplied solution - it achieves the same effect as
JMock's LIFOInvocationDispatcher.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mocha-developer/attachments/20070102/617dd19d/attachment-0001.html 

More information about the mocha-developer mailing list