Module: WebMock::API

Defined in:
lib/ledger_sync/test/support/webmock_helpers.rb

Instance Method Summary collapse

Instance Method Details

#stub_request(*args, times: 1) ⇒ Object

Overwrite the original stub_request method to enforce we explicitly say how many times we expect a request to be called



15
16
17
18
19
20
# File 'lib/ledger_sync/test/support/webmock_helpers.rb', line 15

def stub_request(*args, times: 1)
  ret = WebMock::StubRegistry.instance
                             .register_request_stub(WebMock::RequestStub.new(*args))
  stubs_and_times << [ret, times] unless times.nil?
  ret
end