[mocha-developer] Set the return value to "same as block"

James Mead jamesmead44 at gmail.com
Sun Jul 22 13:12:36 EDT 2007

Thanks for taking the time to explain more fully. We know that there are
shortcomings in Mocha regarding blocks.

It looks to me like you are trying to find a way to indirectly test the code
in the block.

While I can see how your solution works in some cases, I'm not sure it is a
generic solution e.g. what if a method accepts multiple blocks or what if
the result of the block is not normally returned by the method being mocked.

One thing I've been planning on doing for a while is to provide a way to use
a new parameter matcher that can check for a block being passed to a mocked
method. I think it would have to work by comparing an expected result with
the result of executing the block.

I have to admit to being a bit undecided about all of this. I think one
thing I need to do is to write up a series of scenarios that we need to

Let me know if I've misunderstood or if you've got any other ideas how to
make the handling of blocks more straightforward.


More information about the mocha-developer mailing list