Rspec-mocks has expect(some_object).to receive(:some_method).and_call_original
. Can I do this with Mocha, and if so, how? some_object.expects(:some_method)....
...what?
rspec-mocks helps to control the context in a code example by letting you set known return. values, fake implementations of methods, and even set expectations that specific messages. are received by an object.
Mocks are “smart” stubs, their purpose is to verify that some method was called. They are created with some expectations (expected method calls) and can then be verified to ensure those methods were called.
I'm fairly sure that there isn't a way to do this.
Looking through the source code, there's a comment that mentions that the original method is completely replaced.
# The original implementation of the method is replaced during the test and then restored at the end of the test. The temporary replacement method has the same visibility as the original method.
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