vcr 2.0.0.rc1 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.limited_red +1 -0
- data/.travis.yml +10 -1
- data/.yardopts +9 -0
- data/CHANGELOG.md +51 -1
- data/Gemfile +5 -1
- data/LICENSE +1 -1
- data/README.md +23 -28
- data/Rakefile +63 -18
- data/Upgrade.md +200 -0
- data/features/.nav +2 -0
- data/features/cassettes/automatic_re_recording.feature +19 -15
- data/features/cassettes/dynamic_erb.feature +12 -4
- data/features/cassettes/exclusive.feature +31 -23
- data/features/cassettes/format.feature +54 -30
- data/features/cassettes/naming.feature +1 -1
- data/features/cassettes/update_content_length_header.feature +16 -12
- data/features/configuration/allow_http_connections_when_no_cassette.feature +1 -1
- data/features/configuration/debug_logging.feature +52 -0
- data/features/configuration/filter_sensitive_data.feature +4 -4
- data/features/configuration/hook_into.feature +5 -2
- data/features/configuration/ignore_request.feature +5 -3
- data/features/configuration/preserve_exact_body_bytes.feature +103 -0
- data/features/hooks/after_http_request.feature +17 -4
- data/features/hooks/around_http_request.feature +2 -1
- data/features/hooks/before_http_request.feature +25 -8
- data/features/hooks/before_playback.feature +16 -12
- data/features/hooks/before_record.feature +2 -2
- data/features/http_libraries/em_http_request.feature +82 -58
- data/features/http_libraries/net_http.feature +6 -6
- data/features/middleware/faraday.feature +2 -1
- data/features/middleware/rack.feature +2 -2
- data/features/record_modes/all.feature +19 -15
- data/features/record_modes/new_episodes.feature +17 -13
- data/features/record_modes/none.feature +15 -11
- data/features/record_modes/once.feature +16 -12
- data/features/request_matching/body.feature +28 -20
- data/features/request_matching/custom_matcher.feature +28 -20
- data/features/request_matching/headers.feature +34 -26
- data/features/request_matching/host.feature +28 -20
- data/features/request_matching/identical_request_sequence.feature +28 -20
- data/features/request_matching/method.feature +28 -20
- data/features/request_matching/path.feature +28 -20
- data/features/request_matching/playback_repeats.feature +28 -20
- data/features/request_matching/uri.feature +28 -20
- data/features/request_matching/uri_without_param.feature +28 -20
- data/features/support/env.rb +7 -6
- data/features/support/vcr_cucumber_helpers.rb +1 -0
- data/features/test_frameworks/cucumber.feature +8 -8
- data/features/test_frameworks/rspec_macro.feature +4 -4
- data/features/test_frameworks/rspec_metadata.feature +6 -6
- data/features/test_frameworks/shoulda.feature +1 -1
- data/features/test_frameworks/test_unit.feature +1 -1
- data/lib/vcr.rb +156 -5
- data/lib/vcr/cassette.rb +80 -30
- data/lib/vcr/cassette/http_interaction_list.rb +33 -4
- data/lib/vcr/cassette/migrator.rb +2 -3
- data/lib/vcr/cassette/reader.rb +1 -0
- data/lib/vcr/cassette/serializers.rb +22 -0
- data/lib/vcr/cassette/serializers/json.rb +27 -2
- data/lib/vcr/cassette/serializers/psych.rb +26 -2
- data/lib/vcr/cassette/serializers/syck.rb +28 -2
- data/lib/vcr/cassette/serializers/yaml.rb +28 -2
- data/lib/vcr/configuration.rb +348 -10
- data/lib/vcr/deprecations.rb +8 -0
- data/lib/vcr/errors.rb +40 -0
- data/lib/vcr/extensions/net_http_response.rb +12 -11
- data/lib/vcr/library_hooks.rb +1 -0
- data/lib/vcr/library_hooks/excon.rb +24 -3
- data/lib/vcr/library_hooks/fakeweb.rb +32 -16
- data/lib/vcr/library_hooks/faraday.rb +3 -0
- data/lib/vcr/library_hooks/typhoeus.rb +40 -37
- data/lib/vcr/library_hooks/webmock.rb +54 -34
- data/lib/vcr/middleware/faraday.rb +13 -0
- data/lib/vcr/middleware/rack.rb +35 -0
- data/lib/vcr/request_handler.rb +60 -8
- data/lib/vcr/request_ignorer.rb +1 -0
- data/lib/vcr/request_matcher_registry.rb +28 -0
- data/lib/vcr/structs.rb +245 -38
- data/lib/vcr/test_frameworks/cucumber.rb +10 -0
- data/lib/vcr/test_frameworks/rspec.rb +26 -1
- data/lib/vcr/util/hooks.rb +29 -27
- data/lib/vcr/util/internet_connection.rb +2 -0
- data/lib/vcr/util/logger.rb +25 -0
- data/lib/vcr/util/variable_args_block_caller.rb +1 -0
- data/lib/vcr/util/version_checker.rb +1 -0
- data/lib/vcr/version.rb +8 -1
- data/spec/capture_warnings.rb +3 -3
- data/spec/monkey_patches.rb +28 -13
- data/spec/spec_helper.rb +17 -0
- data/spec/support/http_library_adapters.rb +7 -4
- data/spec/support/shared_example_groups/hook_into_http_library.rb +96 -32
- data/spec/support/shared_example_groups/request_hooks.rb +9 -8
- data/spec/support/sinatra_app.rb +3 -1
- data/spec/support/vcr_localhost_server.rb +1 -0
- data/spec/vcr/cassette/http_interaction_list_spec.rb +119 -54
- data/spec/vcr/cassette/migrator_spec.rb +19 -6
- data/spec/vcr/cassette/serializers_spec.rb +51 -6
- data/spec/vcr/cassette_spec.rb +44 -19
- data/spec/vcr/configuration_spec.rb +91 -6
- data/spec/vcr/library_hooks/excon_spec.rb +54 -16
- data/spec/vcr/library_hooks/fakeweb_spec.rb +12 -21
- data/spec/vcr/library_hooks/typhoeus_spec.rb +2 -29
- data/spec/vcr/library_hooks/webmock_spec.rb +4 -18
- data/spec/vcr/middleware/faraday_spec.rb +1 -16
- data/spec/vcr/structs_spec.rb +194 -61
- data/spec/vcr/test_frameworks/rspec_spec.rb +10 -0
- data/spec/vcr/util/hooks_spec.rb +104 -56
- data/spec/vcr/util/version_checker_spec.rb +45 -0
- data/spec/vcr_spec.rb +11 -0
- data/vcr.gemspec +30 -34
- metadata +149 -95
- data/spec/support/shared_example_groups/version_checking.rb +0 -34
@@ -9,37 +9,45 @@ Feature: Matching on Host
|
|
9
9
|
Background:
|
10
10
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
11
11
|
"""
|
12
|
-
---
|
13
|
-
http_interactions:
|
14
|
-
- request:
|
12
|
+
---
|
13
|
+
http_interactions:
|
14
|
+
- request:
|
15
15
|
method: post
|
16
16
|
uri: http://host1.com/some/long/path
|
17
|
-
body:
|
17
|
+
body:
|
18
|
+
encoding: UTF-8
|
19
|
+
string: ""
|
18
20
|
headers: {}
|
19
|
-
response:
|
20
|
-
status:
|
21
|
+
response:
|
22
|
+
status:
|
21
23
|
code: 200
|
22
24
|
message: OK
|
23
|
-
headers:
|
24
|
-
Content-Length:
|
25
|
-
-
|
26
|
-
body:
|
27
|
-
|
25
|
+
headers:
|
26
|
+
Content-Length:
|
27
|
+
- "14"
|
28
|
+
body:
|
29
|
+
encoding: UTF-8
|
30
|
+
string: host1 response
|
31
|
+
http_version: "1.1"
|
28
32
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
29
|
-
- request:
|
33
|
+
- request:
|
30
34
|
method: post
|
31
35
|
uri: http://host2.com/some/other/long/path
|
32
|
-
body:
|
36
|
+
body:
|
37
|
+
encoding: UTF-8
|
38
|
+
string: ""
|
33
39
|
headers: {}
|
34
|
-
response:
|
35
|
-
status:
|
40
|
+
response:
|
41
|
+
status:
|
36
42
|
code: 200
|
37
43
|
message: OK
|
38
|
-
headers:
|
39
|
-
Content-Length:
|
40
|
-
-
|
41
|
-
body:
|
42
|
-
|
44
|
+
headers:
|
45
|
+
Content-Length:
|
46
|
+
- "16"
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: host2 response
|
50
|
+
http_version: "1.1"
|
43
51
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
44
52
|
recorded_with: VCR 2.0.0
|
45
53
|
"""
|
@@ -8,37 +8,45 @@ Feature: Identical requests are replayed in sequence
|
|
8
8
|
Scenario Outline: identical requests are replayed in sequence
|
9
9
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
10
10
|
"""
|
11
|
-
---
|
12
|
-
http_interactions:
|
13
|
-
- request:
|
11
|
+
---
|
12
|
+
http_interactions:
|
13
|
+
- request:
|
14
14
|
method: get
|
15
15
|
uri: http://example.com/foo
|
16
|
-
body:
|
16
|
+
body:
|
17
|
+
encoding: UTF-8
|
18
|
+
string: ""
|
17
19
|
headers: {}
|
18
|
-
response:
|
19
|
-
status:
|
20
|
+
response:
|
21
|
+
status:
|
20
22
|
code: 200
|
21
23
|
message: OK
|
22
|
-
headers:
|
23
|
-
Content-Length:
|
24
|
-
-
|
25
|
-
body:
|
26
|
-
|
24
|
+
headers:
|
25
|
+
Content-Length:
|
26
|
+
- "10"
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: Response 1
|
30
|
+
http_version: "1.1"
|
27
31
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
28
|
-
- request:
|
32
|
+
- request:
|
29
33
|
method: get
|
30
34
|
uri: http://example.com/foo
|
31
|
-
body:
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: ""
|
32
38
|
headers: {}
|
33
|
-
response:
|
34
|
-
status:
|
39
|
+
response:
|
40
|
+
status:
|
35
41
|
code: 200
|
36
42
|
message: OK
|
37
|
-
headers:
|
38
|
-
Content-Length:
|
39
|
-
-
|
40
|
-
body:
|
41
|
-
|
43
|
+
headers:
|
44
|
+
Content-Length:
|
45
|
+
- "10"
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: Response 2
|
49
|
+
http_version: "1.1"
|
42
50
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
43
51
|
recorded_with: VCR 2.0.0
|
44
52
|
"""
|
@@ -10,37 +10,45 @@ Feature: Matching on Method
|
|
10
10
|
Background:
|
11
11
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
12
12
|
"""
|
13
|
-
---
|
14
|
-
http_interactions:
|
15
|
-
- request:
|
13
|
+
---
|
14
|
+
http_interactions:
|
15
|
+
- request:
|
16
16
|
method: post
|
17
17
|
uri: http://post-request.com/
|
18
|
-
body:
|
18
|
+
body:
|
19
|
+
encoding: UTF-8
|
20
|
+
string: ""
|
19
21
|
headers: {}
|
20
|
-
response:
|
21
|
-
status:
|
22
|
+
response:
|
23
|
+
status:
|
22
24
|
code: 200
|
23
25
|
message: OK
|
24
|
-
headers:
|
25
|
-
Content-Length:
|
26
|
-
-
|
27
|
-
body:
|
28
|
-
|
26
|
+
headers:
|
27
|
+
Content-Length:
|
28
|
+
- "13"
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: post response
|
32
|
+
http_version: "1.1"
|
29
33
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
30
|
-
- request:
|
34
|
+
- request:
|
31
35
|
method: get
|
32
36
|
uri: http://get-request.com/
|
33
|
-
body:
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: ""
|
34
40
|
headers: {}
|
35
|
-
response:
|
36
|
-
status:
|
41
|
+
response:
|
42
|
+
status:
|
37
43
|
code: 200
|
38
44
|
message: OK
|
39
|
-
headers:
|
40
|
-
Content-Length:
|
41
|
-
-
|
42
|
-
body:
|
43
|
-
|
45
|
+
headers:
|
46
|
+
Content-Length:
|
47
|
+
- "12"
|
48
|
+
body:
|
49
|
+
encoding: UTF-8
|
50
|
+
string: get response
|
51
|
+
http_version: "1.1"
|
44
52
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
45
53
|
recorded_with: VCR 2.0.0
|
46
54
|
"""
|
@@ -10,37 +10,45 @@ Feature: Matching on Path
|
|
10
10
|
Background:
|
11
11
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
12
12
|
"""
|
13
|
-
---
|
14
|
-
http_interactions:
|
15
|
-
- request:
|
13
|
+
---
|
14
|
+
http_interactions:
|
15
|
+
- request:
|
16
16
|
method: post
|
17
17
|
uri: http://host1.com/about?date=2011-09-01
|
18
|
-
body:
|
18
|
+
body:
|
19
|
+
encoding: UTF-8
|
20
|
+
string: ""
|
19
21
|
headers: {}
|
20
|
-
response:
|
21
|
-
status:
|
22
|
+
response:
|
23
|
+
status:
|
22
24
|
code: 200
|
23
25
|
message: OK
|
24
|
-
headers:
|
25
|
-
Content-Length:
|
26
|
-
-
|
27
|
-
body:
|
28
|
-
|
26
|
+
headers:
|
27
|
+
Content-Length:
|
28
|
+
- "14"
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: about response
|
32
|
+
http_version: "1.1"
|
29
33
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
30
|
-
- request:
|
34
|
+
- request:
|
31
35
|
method: post
|
32
36
|
uri: http://host2.com/home?date=2011-09-01
|
33
|
-
body:
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: ""
|
34
40
|
headers: {}
|
35
|
-
response:
|
36
|
-
status:
|
41
|
+
response:
|
42
|
+
status:
|
37
43
|
code: 200
|
38
44
|
message: OK
|
39
|
-
headers:
|
40
|
-
Content-Length:
|
41
|
-
-
|
42
|
-
body:
|
43
|
-
|
45
|
+
headers:
|
46
|
+
Content-Length:
|
47
|
+
- "15"
|
48
|
+
body:
|
49
|
+
encoding: UTF-8
|
50
|
+
string: home response
|
51
|
+
http_version: "1.1"
|
44
52
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
45
53
|
recorded_with: VCR 2.0.0
|
46
54
|
"""
|
@@ -16,37 +16,45 @@ Feature: Playback repeats
|
|
16
16
|
Scenario: Responses do not repeat by default
|
17
17
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
18
18
|
"""
|
19
|
-
---
|
20
|
-
http_interactions:
|
21
|
-
- request:
|
19
|
+
---
|
20
|
+
http_interactions:
|
21
|
+
- request:
|
22
22
|
method: get
|
23
23
|
uri: http://example.com/foo
|
24
|
-
body:
|
24
|
+
body:
|
25
|
+
encoding: UTF-8
|
26
|
+
string: ""
|
25
27
|
headers: {}
|
26
|
-
response:
|
27
|
-
status:
|
28
|
+
response:
|
29
|
+
status:
|
28
30
|
code: 200
|
29
31
|
message: OK
|
30
|
-
headers:
|
31
|
-
Content-Length:
|
32
|
-
-
|
33
|
-
body:
|
34
|
-
|
32
|
+
headers:
|
33
|
+
Content-Length:
|
34
|
+
- "10"
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: Response 1
|
38
|
+
http_version: "1.1"
|
35
39
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
36
|
-
- request:
|
40
|
+
- request:
|
37
41
|
method: get
|
38
42
|
uri: http://example.com/foo
|
39
|
-
body:
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: ""
|
40
46
|
headers: {}
|
41
|
-
response:
|
42
|
-
status:
|
47
|
+
response:
|
48
|
+
status:
|
43
49
|
code: 200
|
44
50
|
message: OK
|
45
|
-
headers:
|
46
|
-
Content-Length:
|
47
|
-
-
|
48
|
-
body:
|
49
|
-
|
51
|
+
headers:
|
52
|
+
Content-Length:
|
53
|
+
- "10"
|
54
|
+
body:
|
55
|
+
encoding: UTF-8
|
56
|
+
string: Response 2
|
57
|
+
http_version: "1.1"
|
50
58
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
51
59
|
recorded_with: VCR 2.0.0
|
52
60
|
"""
|
@@ -8,37 +8,45 @@ Feature: Matching on URI
|
|
8
8
|
Background:
|
9
9
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
10
10
|
"""
|
11
|
-
---
|
12
|
-
http_interactions:
|
13
|
-
- request:
|
11
|
+
---
|
12
|
+
http_interactions:
|
13
|
+
- request:
|
14
14
|
method: post
|
15
15
|
uri: http://example.com/foo
|
16
|
-
body:
|
16
|
+
body:
|
17
|
+
encoding: UTF-8
|
18
|
+
string: ""
|
17
19
|
headers: {}
|
18
|
-
response:
|
19
|
-
status:
|
20
|
+
response:
|
21
|
+
status:
|
20
22
|
code: 200
|
21
23
|
message: OK
|
22
|
-
headers:
|
23
|
-
Content-Length:
|
24
|
-
-
|
25
|
-
body:
|
26
|
-
|
24
|
+
headers:
|
25
|
+
Content-Length:
|
26
|
+
- "12"
|
27
|
+
body:
|
28
|
+
encoding: UTF-8
|
29
|
+
string: foo response
|
30
|
+
http_version: "1.1"
|
27
31
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
28
|
-
- request:
|
32
|
+
- request:
|
29
33
|
method: post
|
30
34
|
uri: http://example.com/bar
|
31
|
-
body:
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: ""
|
32
38
|
headers: {}
|
33
|
-
response:
|
34
|
-
status:
|
39
|
+
response:
|
40
|
+
status:
|
35
41
|
code: 200
|
36
42
|
message: OK
|
37
|
-
headers:
|
38
|
-
Content-Length:
|
39
|
-
-
|
40
|
-
body:
|
41
|
-
|
43
|
+
headers:
|
44
|
+
Content-Length:
|
45
|
+
- "12"
|
46
|
+
body:
|
47
|
+
encoding: UTF-8
|
48
|
+
string: bar response
|
49
|
+
http_version: "1.1"
|
42
50
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
43
51
|
recorded_with: VCR 2.0.0
|
44
52
|
"""
|
@@ -16,37 +16,45 @@ Feature: URI without param(s)
|
|
16
16
|
Background:
|
17
17
|
Given a previously recorded cassette file "cassettes/example.yml" with:
|
18
18
|
"""
|
19
|
-
---
|
20
|
-
http_interactions:
|
21
|
-
- request:
|
19
|
+
---
|
20
|
+
http_interactions:
|
21
|
+
- request:
|
22
22
|
method: get
|
23
23
|
uri: http://example.com/search?q=foo×tamp=1316920490
|
24
|
-
body:
|
24
|
+
body:
|
25
|
+
encoding: UTF-8
|
26
|
+
string: ""
|
25
27
|
headers: {}
|
26
|
-
response:
|
27
|
-
status:
|
28
|
+
response:
|
29
|
+
status:
|
28
30
|
code: 200
|
29
31
|
message: OK
|
30
|
-
headers:
|
31
|
-
Content-Length:
|
32
|
-
-
|
33
|
-
body:
|
34
|
-
|
32
|
+
headers:
|
33
|
+
Content-Length:
|
34
|
+
- "12"
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: foo response
|
38
|
+
http_version: "1.1"
|
35
39
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
36
|
-
- request:
|
40
|
+
- request:
|
37
41
|
method: get
|
38
42
|
uri: http://example.com/search?q=bar×tamp=1296723437
|
39
|
-
body:
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: ""
|
40
46
|
headers: {}
|
41
|
-
response:
|
42
|
-
status:
|
47
|
+
response:
|
48
|
+
status:
|
43
49
|
code: 200
|
44
50
|
message: OK
|
45
|
-
headers:
|
46
|
-
Content-Length:
|
47
|
-
-
|
48
|
-
body:
|
49
|
-
|
51
|
+
headers:
|
52
|
+
Content-Length:
|
53
|
+
- "12"
|
54
|
+
body:
|
55
|
+
encoding: UTF-8
|
56
|
+
string: bar response
|
57
|
+
http_version: "1.1"
|
50
58
|
recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
|
51
59
|
recorded_with: VCR 2.0.0
|
52
60
|
"""
|