[mocha-developer] Testing event driven Socket classes

James Mead jamesmead44 at gmail.com
Sat Dec 16 05:40:52 EST 2006

I think you have misunderstood what Mocha is doing for you. When you
use expects() or stubs() on a real object, Mocha temporarily replaces
the named method with a new implementation which can verify the method
was called in the way you expected and/or return the specified result.
The original implementation is not invoked.

So when you have...


send_to_client is indeed being called - try commenting out the call to
send_to_client in dispatch_request and you will see a Mocha
expectation error - but the original implementation of send_to_client
is not invoked.

And when you have...


send_to_client is never called, because the original implementation of
dispatch_request is not invoked.


More information about the mocha-developer mailing list