forked from vcr/vcr
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some failing scenarios for the new :match_requests_on feature I…
…'m working on.
- Loading branch information
1 parent
3ced987
commit 9a98992
Showing
7 changed files
with
164 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
features/fixtures/vcr_cassettes/1.9.1/match_requests_on.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- !ruby/struct:VCR::HTTPInteraction | ||
:request: !ruby/struct:VCR::Request | ||
:method: :post | ||
:uri: http://example.com:80/ | ||
:body: foo=bar | ||
:headers: | ||
x-http-user: | ||
- bob | ||
:response: !ruby/struct:VCR::Response | ||
:status: !ruby/struct:VCR::ResponseStatus | ||
:code: 200 | ||
:message: OK | ||
:headers: | ||
etag: | ||
- "\"24ec5-1b6-4059a80bfd280\"" | ||
:body: foo=bar response | bob response | ||
:http_version: "1.1" | ||
- !ruby/struct:VCR::HTTPInteraction | ||
:request: !ruby/struct:VCR::Request | ||
:method: :post | ||
:uri: http://example.com:80/ | ||
:body: bar=bazz | ||
:headers: | ||
x-http-user: | ||
- joe | ||
:response: !ruby/struct:VCR::Response | ||
:status: !ruby/struct:VCR::ResponseStatus | ||
:code: 200 | ||
:message: OK | ||
:headers: | ||
etag: | ||
- "\"24ec5-1b6-4059a80bfd280\"" | ||
:body: bar=bazz response | joe response | ||
:http_version: "1.1" |
35 changes: 35 additions & 0 deletions
35
features/fixtures/vcr_cassettes/not_1.9.1/match_requests_on.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
- !ruby/struct:VCR::HTTPInteraction | ||
request: !ruby/struct:VCR::Request | ||
method: :post | ||
uri: http://example.com:80/ | ||
body: foo=bar | ||
headers: | ||
x-http-user: | ||
- bob | ||
response: !ruby/struct:VCR::Response | ||
status: !ruby/struct:VCR::ResponseStatus | ||
code: 200 | ||
message: OK | ||
headers: | ||
etag: | ||
- "\"24ec5-1b6-4059a80bfd280\"" | ||
body: foo=bar response | bob response | ||
http_version: "1.1" | ||
- !ruby/struct:VCR::HTTPInteraction | ||
request: !ruby/struct:VCR::Request | ||
method: :post | ||
uri: http://example.com:80/ | ||
body: bar=bazz | ||
headers: | ||
x-http-user: | ||
- joe | ||
response: !ruby/struct:VCR::Response | ||
status: !ruby/struct:VCR::ResponseStatus | ||
code: 200 | ||
message: OK | ||
headers: | ||
etag: | ||
- "\"24ec5-1b6-4059a80bfd280\"" | ||
body: bar=bazz response | joe response | ||
http_version: "1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@webmock | ||
Feature: Replay recorded response | ||
In order to have deterministic, fast tests that do not depend on an internet connection | ||
As a TDD/BDD developer who uses WebMock | ||
I want to replay responses for requests I have previously recorded | ||
|
||
Scenario: Use the :match_requests_on option to differentiate requests by request body (for "foo=bar") | ||
Given the "match_requests_on" library file has a response for "http://example.com/" with the request body "foo=bar" that matches /foo=bar response/ | ||
When I make an HTTP post request to "http://example.com/" with request body "foo=bar" within the "match_requests_on" cassette using cassette options: { :match_requests_on => [:uri, :body], :record => :none } | ||
Then the response for "http://example.com/" should match /foo=bar response/ | ||
|
||
Scenario: Use the :match_requests_on option to differentiate requests by request body (for "bar=bazz") | ||
Given the "match_requests_on" library file has a response for "http://example.com/" with the request body "bar=bazz" that matches /bar=bazz response/ | ||
When I make an HTTP post request to "http://example.com/" with request body "bar=bazz" within the "match_requests_on" cassette using cassette options: { :match_requests_on => [:uri, :body], :record => :none } | ||
Then the response for "http://example.com/" should match /bar=bazz response/ | ||
|
||
Scenario: Use the :match_requests_on option to differentiate requests by request header (for "X-HTTP-USER=joe") | ||
Given the "match_requests_on" library file has a response for "http://example.com/" with the request header "X-HTTP-USER=joe" that matches /joe response/ | ||
When I make an HTTP post request to "http://example.com/" with request header "X-HTTP-USER=joe" within the "match_requests_on" cassette using cassette options: { :match_requests_on => [:uri, :headers], :record => :none } | ||
Then the response for "http://example.com/" should match /joe response/ | ||
|
||
Scenario: Use the :match_requests_on option to differentiate requests by request header (for "X-HTTP-USER=bob") | ||
Given the "match_requests_on" library file has a response for "http://example.com/" with the request header "X-HTTP-USER=bob" that matches /bob response/ | ||
When I make an HTTP post request to "http://example.com/" with request header "X-HTTP-USER=bob" within the "match_requests_on" cassette using cassette options: { :match_requests_on => [:uri, :headers], :record => :none } | ||
Then the response for "http://example.com/" should match /bob response/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters