I have a scenario more or less like this
class A
def initialize(&block)
b = B.new(&block)
end
end
I am unit testing class A and I want to know if B#new is receiving the block passed to A#new. I am using Mocha as mock framework.
Is it possible?
I think you want:
l = lambda {}
B.expects(:new).with(l)
A.new(&l)
I know this works with RSpec, I'd be surprised if Mocha doesn't handle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With