Setting an expectation from a RequestStub #83

Closed
afeld opened this Issue Apr 8, 2011 · 3 comments

Projects

None yet

2 participants

@afeld
afeld commented Apr 8, 2011

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 Jun 5, 2011

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

@afeld
afeld commented Jun 6, 2011

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

@afeld
afeld commented Jun 6, 2011

See pull request #103.

@afeld afeld closed this Jun 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment