[rspec-users] (no subject)
matt at mattwynne.net
Mon Jun 7 10:25:32 EDT 2010
On 7 Jun 2010, at 15:13, Ben Butler-Cole wrote:
> 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.
Have you seen and_yield? I can't quite get my head around what you're trying to do, but it might help anyway:
> rspec-users mailing list
> rspec-users at rubyforge.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users