0

It is possible to count the number of times a method is called using RSpec. However this technique stubs out the method requiring you to provide a return value (otherwise it'll return nil). Is it possible to count the number of times a method is called without stubbing it? I still want the method to run and return the value it normally should.

CBK
  • 141
  • 1
  • 6
  • 1
    RSpec provides [and_call_original](https://relishapp.com/rspec/rspec-mocks/docs/configuring-responses/calling-the-original-implementation) for calling the original implementation – Sampat Badhe Jan 13 '22 at 23:29
  • 1
    @SampatBadhe This looks like exactly what I'm asking for. Thanks! – CBK Jan 14 '22 at 16:15

0 Answers0