Is there any method to remove any stubbing and mocking while using RSpec?
Example:
RestClient.should_receive(:delete).with("http://www.example.com") ... ... # this will remove the mocking of "should_receive" and # restore the proper "delete" method on "RestClient". RestClient.mocking_reset
(mocking_reset
is my ficticious name for the required functionality).
I know that there is the method "unstub" which resets "stubs" but not "should_receive"s.
So, is there any method equivalent to "unstub" but for "should_receive"?
Panayotis
You can overwrite some previous mocking by:
expect(RestClient).to receive(:delete).and_call_original
Or if it is wasn't any kind of expectation, just a simple stub:
allow(RestClient).to receive(:delete).and_call_original
Remember there exists also expect_any_instance_of
and allow_any_instance_of
.
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