I wanted to do the following within rspec: Test that a method get's called with a particular argument no matter what the others are.
For example I would like to test MyClass.receive(:new).with(anything, anything, testedObject). Is this possible to do with rspec?
Yes, see doc:
MyClass.should_receive(:new).with(anything, anything, your_object)
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