Skip to content

Loading…

Setting an expectation from a RequestStub #83

Closed
afeld opened this Issue · 3 comments

2 participants

@afeld

Currently, there is a lot of duplicated code when doing webmock stubs and then expectations, i.e.

stub_request(:any, "www.example.com").with( ... )
## stuff happens ##
WebMock.should have_requested(:get, "www.example.com").with( ... ).twice

The details in those ellipses (...) can get really long - it would be nice (and more DRY) to be able to set expectations directly on RequestStubs, i.e.

@request = stub_request(:any, "www.example.com").with( ... )
## stuff happens ##
@request.should have_been_made.twice
@jcf
Collaborator
jcf commented

This sounds like a nice idea. Fancy having a stab at the implementation and sending a pull request?

@afeld

Sure - just wasn't sure if they were intentionally separated.

@afeld

See pull request #103.

@afeld afeld closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.