[rspec-users] Message expectation that verifies result of passed block

Ashley Moran ashley.moran at patchspace.co.uk
Thu Jan 28 14:27:17 EST 2010

On Jan 28, 2010, at 1:29 pm, Paul Hinze wrote:

> I believe the lack of ability to use this notation comes down to a ruby
> limitation, but I'm not sure.  If that's the case, then we would need a
> specific argument expectation (along the lines of my suggestion) that
> executes in a context in which it can call the block.

I can't find a solution, I suspect Ruby 1.8 can't do this, but I'm guessing.

Can I ask why you want to do this though?  As another example, it would be unusual to spec something like:

  @array = [1, 2, 3]

You'd instead check that the array that came out was [2, 4, 6].



More information about the rspec-users mailing list