Displaying 1 result from an estimated 1 matches for "trapped_block".
Did you mean:
wrapped_block
2008 May 03
0
Block trap
...sible to
trap the block that was being passed in:
def do_something(foo)
Bar.transaction do
foo.baz()
end
end
I''d like my test to prove that foo.baz() is executed inside the
block. Normally I would have written something like this:
def test
foo = mock("foo")
trapped_block = Bar.expects(:transaction).trap
target.do_something(foo)
foo.expects(:baz)
trapped_block.execute()
end