Skip to content


Subversion checkout URL

You can clone with
Download ZIP


a_request usage #141

wants to merge 2 commits into from

2 participants


Hi there:

This explains in readme pattern to use the expectations in reference to after the actual request, still using stub before the actual request.

In RSpec, you could be having stuff .should_receive where you set expectations mostly before doing the real call(in this case request).

This is to help others not to be confused by the usage of these expectations.
I was a bit confused but the past tense used helped me to finally reach at the conclusion.

Thanks for the great gem,
Rohit Sachdeva..


Thanks for feedback and patch. If someone is used to RSpec it can be indeed confusing that WebMock uses stub-run-verify convention.
I'd like WebMock to have proper documentation, with all functionalities well documented separately.

@bblimke bblimke closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 1 deletion.
  1. +9 −1
@@ -350,6 +350,15 @@ This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`.
## Setting Expectations
+### Using Expectations
+ These expectations below are set After making request
+ # stub_request as usual
+ # make request
+ # expectation that matches the request made
### Setting expectations in Test::Unit
require 'webmock/test_unit'
@@ -377,7 +386,6 @@ This forces WebMock Net::HTTP adapter to always connect on `Net::HTTP.start`.
assert_requested :get, "" # ===> Success
### Setting expectations in RSpec on `WebMock` module
This style is borrowed from [fakeweb-matcher](
Something went wrong with that request. Please try again.