I am using the version of minitest with Ruby 1.9.3 How do I test for multiple invocations of a mock with it? I need something like
mockObject.expect.times(2) :method, [return_1 first time, return_2 second time]
mockObject.verify
Is there a way to achieve this?
You need to call expect
for each time the method is to be called.
mockObject.expect :method, return_1, [first, time, args]
mockObject.expect :method, return_2, [second, time, args]
# run your code using the mock object
mockObject.verify
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