Sorry if this is a duplicate post. I''m trying to test this the couldn''t figure out if it was possible 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