Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # defined in my spec_helper
- # requires mocha
- # needed because
- # mock() { expects(:foo).with(:bar, anything) }
- # does not work. (fails with "Mocha::ExpectationError: unexpected invocation: #<Mock:0x1d8>.anything()")
- # Usage:
- # mock_block() do |m|
- # m.expects(:foo).with(:bar, anything)
- # end
- def mock_block(&block)
- m = mock()
- yield m if block_given?
- m
- end
Add Comment
Please, Sign In to add comment