How to use with expect?
Opened this issue · 2 comments
georgeu2000 commented
expect(WebMock).to have_requested(:get, "http://google.com").once
Is this supported?
watzon commented
Also wanting to know this. The ruby version of webmock has the a_request
method, something like that would be nice.
jackturnbull commented
Late to the party but I've decided to comment for once because this is the second time I've figured this out from looking into the source (tried it last year and since forgot).
mock = WebMock.stub(:get, url).to_return(body: "")
HTTP::Client.get(url)
mock.calls.should eq 1