webmock.cr icon indicating copy to clipboard operation
webmock.cr copied to clipboard

How to use with expect?

Open georgeu2000 opened this issue 8 years ago • 2 comments

      expect(WebMock).to have_requested(:get, "http://google.com").once

Is this supported?

georgeu2000 avatar Oct 08 '17 21:10 georgeu2000

Also wanting to know this. The ruby version of webmock has the a_request method, something like that would be nice.

watzon avatar Feb 28 '18 08:02 watzon

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

jackturnbull avatar Feb 17 '19 22:02 jackturnbull