How to reset a Mock

Posted . Visible to the public.

With Rspec you can mock objects or functions, for example like this:

expect(my_object).to receive(:my_function).and_return('hello world')

It's also easy to remove mocks for an object:

RSpec::Mocks.space.proxy_for(my_object).reset
Judith Roth
Last edit
Judith Roth
Keywords
unmock, delete, stub
License
Source code in this card is licensed under the MIT License.
Posted by Judith Roth to makandra dev (2020-06-04 12:43)