Read more

How to reset a Mock

Judith Roth
June 04, 2020Software engineer at makandra GmbH

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

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

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
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 by Judith Roth to makandra dev (2020-06-04 14:43)