[rspec-users] (no subject)

Ben Butler-Cole ben.butlercole at gmail.com
Mon Jun 7 10:13:23 EDT 2010


I'm trying to use RSpec's mocks to describe code which passes a block to a
collaborator. I want to write an assertion against the value returned by the
block. I can't find any explicit support for this in RSpec, but perhaps I
have missed something.

I have come up with a hack which almost does what I want, by hijacking the
and_return block (see http://gist.github.com/428624). But this doesn't work
for more complex cases where there are multiple calls in the code under test
which pass different blocks.

Is there any way to make assertions like this? From looking at the code, I
think it would take some significant changes to support this; but it doesn't
seem to be a terribly esoteric use case.

Thanks for any suggestions.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100607/a2241d4c/attachment.html>

More information about the rspec-users mailing list