Read more

How to reset a Mock

Deleted user #4117
June 04, 2020Software engineer

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

expect(my_object).to receive(:my_function).and_return('hello world')
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

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

RSpec::Mocks.space.proxy_for(my_object).reset
Posted to makandra dev (2020-06-04 14:43)