vcr 3.0.3 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +5 -5
  2. data/lib/vcr/cassette/erb_renderer.rb +4 -2
  3. data/lib/vcr/cassette/http_interaction_list.rb +14 -9
  4. data/lib/vcr/cassette/migrator.rb +5 -6
  5. data/lib/vcr/cassette/persisters/file_system.rb +9 -1
  6. data/lib/vcr/cassette/serializers/compressed.rb +2 -2
  7. data/lib/vcr/cassette/serializers/json.rb +14 -8
  8. data/lib/vcr/cassette/serializers/psych.rb +10 -2
  9. data/lib/vcr/cassette/serializers/syck.rb +7 -1
  10. data/lib/vcr/cassette/serializers/yaml.rb +14 -2
  11. data/lib/vcr/cassette/serializers.rb +10 -0
  12. data/lib/vcr/cassette.rb +50 -15
  13. data/lib/vcr/configuration.rb +20 -8
  14. data/lib/vcr/deprecations.rb +0 -62
  15. data/lib/vcr/errors.rb +17 -12
  16. data/lib/vcr/library_hooks/excon.rb +8 -0
  17. data/lib/vcr/library_hooks/typhoeus.rb +91 -79
  18. data/lib/vcr/library_hooks/webmock.rb +2 -11
  19. data/lib/vcr/linked_cassette.rb +4 -4
  20. data/lib/vcr/middleware/excon.rb +1 -1
  21. data/lib/vcr/middleware/faraday.rb +10 -1
  22. data/lib/vcr/request_ignorer.rb +8 -1
  23. data/lib/vcr/request_matcher_registry.rb +3 -3
  24. data/lib/vcr/structs.rb +48 -32
  25. data/lib/vcr/test_frameworks/cucumber.rb +16 -5
  26. data/lib/vcr/test_frameworks/rspec.rb +34 -22
  27. data/lib/vcr/util/hooks.rb +1 -0
  28. data/lib/vcr/util/internet_connection.rb +15 -21
  29. data/lib/vcr/version.rb +2 -2
  30. data/lib/vcr.rb +52 -2
  31. metadata +45 -272
  32. data/features/CHANGELOG.md +0 -710
  33. data/features/CONTRIBUTING.md +0 -26
  34. data/features/LICENSE.md +0 -20
  35. data/features/README.md +0 -339
  36. data/features/Upgrade.md +0 -289
  37. data/features/about_these_examples.md +0 -18
  38. data/features/cassettes/allow_unused_http_interactions.feature +0 -100
  39. data/features/cassettes/automatic_re_recording.feature +0 -72
  40. data/features/cassettes/decompress.feature +0 -74
  41. data/features/cassettes/dynamic_erb.feature +0 -100
  42. data/features/cassettes/exclusive.feature +0 -126
  43. data/features/cassettes/format.feature +0 -411
  44. data/features/cassettes/freezing_time.feature +0 -68
  45. data/features/cassettes/naming.feature +0 -28
  46. data/features/cassettes/no_cassette.feature +0 -152
  47. data/features/cassettes/update_content_length_header.feature +0 -112
  48. data/features/configuration/allow_http_connections_when_no_cassette.feature +0 -55
  49. data/features/configuration/cassette_library_dir.feature +0 -31
  50. data/features/configuration/debug_logging.feature +0 -58
  51. data/features/configuration/default_cassette_options.feature +0 -100
  52. data/features/configuration/filter_sensitive_data.feature +0 -153
  53. data/features/configuration/hook_into.feature +0 -172
  54. data/features/configuration/ignore_request.feature +0 -192
  55. data/features/configuration/preserve_exact_body_bytes.feature +0 -108
  56. data/features/configuration/query_parser.feature +0 -84
  57. data/features/configuration/uri_parser.feature +0 -93
  58. data/features/getting_started.md +0 -82
  59. data/features/hooks/after_http_request.feature +0 -58
  60. data/features/hooks/around_http_request.feature +0 -57
  61. data/features/hooks/before_http_request.feature +0 -63
  62. data/features/hooks/before_playback.feature +0 -184
  63. data/features/hooks/before_record.feature +0 -172
  64. data/features/http_libraries/em_http_request.feature +0 -250
  65. data/features/http_libraries/net_http.feature +0 -179
  66. data/features/middleware/faraday.feature +0 -56
  67. data/features/middleware/rack.feature +0 -92
  68. data/features/record_modes/all.feature +0 -82
  69. data/features/record_modes/new_episodes.feature +0 -79
  70. data/features/record_modes/none.feature +0 -72
  71. data/features/record_modes/once.feature +0 -95
  72. data/features/request_matching/README.md +0 -30
  73. data/features/request_matching/body.feature +0 -91
  74. data/features/request_matching/body_as_json.feature +0 -90
  75. data/features/request_matching/custom_matcher.feature +0 -135
  76. data/features/request_matching/headers.feature +0 -85
  77. data/features/request_matching/host.feature +0 -95
  78. data/features/request_matching/identical_request_sequence.feature +0 -89
  79. data/features/request_matching/method.feature +0 -96
  80. data/features/request_matching/path.feature +0 -96
  81. data/features/request_matching/playback_repeats.feature +0 -98
  82. data/features/request_matching/query.feature +0 -97
  83. data/features/request_matching/uri.feature +0 -94
  84. data/features/request_matching/uri_without_param.feature +0 -101
  85. data/features/step_definitions/cli_steps.rb +0 -199
  86. data/features/support/env.rb +0 -46
  87. data/features/support/http_lib_filters.rb +0 -46
  88. data/features/test_frameworks/cucumber.feature +0 -211
  89. data/features/test_frameworks/rspec_macro.feature +0 -81
  90. data/features/test_frameworks/rspec_metadata.feature +0 -150
  91. data/features/test_frameworks/test_unit.feature +0 -49
  92. data/lib/vcr/extensions/net_http_response.rb +0 -36
  93. data/lib/vcr/library_hooks/fakeweb.rb +0 -197
  94. data/lib/vcr/library_hooks/typhoeus_0.4.rb +0 -103
  95. data/spec/acceptance/concurrency_spec.rb +0 -51
  96. data/spec/acceptance/threading_spec.rb +0 -34
  97. data/spec/fixtures/cassette_spec/1_x_cassette.yml +0 -110
  98. data/spec/fixtures/cassette_spec/empty.yml +0 -0
  99. data/spec/fixtures/cassette_spec/example.yml +0 -111
  100. data/spec/fixtures/cassette_spec/with_localhost_requests.yml +0 -111
  101. data/spec/fixtures/fake_example_responses.yml +0 -110
  102. data/spec/fixtures/match_requests_on.yml +0 -187
  103. data/spec/lib/vcr/cassette/erb_renderer_spec.rb +0 -53
  104. data/spec/lib/vcr/cassette/http_interaction_list_spec.rb +0 -295
  105. data/spec/lib/vcr/cassette/migrator_spec.rb +0 -196
  106. data/spec/lib/vcr/cassette/persisters/file_system_spec.rb +0 -75
  107. data/spec/lib/vcr/cassette/persisters_spec.rb +0 -39
  108. data/spec/lib/vcr/cassette/serializers_spec.rb +0 -182
  109. data/spec/lib/vcr/cassette_spec.rb +0 -618
  110. data/spec/lib/vcr/configuration_spec.rb +0 -326
  111. data/spec/lib/vcr/deprecations_spec.rb +0 -85
  112. data/spec/lib/vcr/errors_spec.rb +0 -178
  113. data/spec/lib/vcr/extensions/net_http_response_spec.rb +0 -86
  114. data/spec/lib/vcr/library_hooks/excon_spec.rb +0 -104
  115. data/spec/lib/vcr/library_hooks/fakeweb_spec.rb +0 -169
  116. data/spec/lib/vcr/library_hooks/faraday_spec.rb +0 -68
  117. data/spec/lib/vcr/library_hooks/typhoeus_0.4_spec.rb +0 -36
  118. data/spec/lib/vcr/library_hooks/typhoeus_spec.rb +0 -162
  119. data/spec/lib/vcr/library_hooks/webmock_spec.rb +0 -117
  120. data/spec/lib/vcr/library_hooks_spec.rb +0 -51
  121. data/spec/lib/vcr/middleware/faraday_spec.rb +0 -181
  122. data/spec/lib/vcr/middleware/rack_spec.rb +0 -115
  123. data/spec/lib/vcr/request_ignorer_spec.rb +0 -70
  124. data/spec/lib/vcr/request_matcher_registry_spec.rb +0 -345
  125. data/spec/lib/vcr/structs_spec.rb +0 -732
  126. data/spec/lib/vcr/test_frameworks/cucumber_spec.rb +0 -107
  127. data/spec/lib/vcr/test_frameworks/rspec_spec.rb +0 -94
  128. data/spec/lib/vcr/util/hooks_spec.rb +0 -158
  129. data/spec/lib/vcr/util/internet_connection_spec.rb +0 -37
  130. data/spec/lib/vcr/util/version_checker_spec.rb +0 -31
  131. data/spec/lib/vcr/version_spec.rb +0 -27
  132. data/spec/lib/vcr_spec.rb +0 -354
  133. data/spec/monkey_patches.rb +0 -186
  134. data/spec/spec_helper.rb +0 -63
  135. data/spec/support/configuration_stubbing.rb +0 -8
  136. data/spec/support/cucumber_helpers.rb +0 -39
  137. data/spec/support/fixnum_extension.rb +0 -10
  138. data/spec/support/http_library_adapters.rb +0 -289
  139. data/spec/support/limited_uri.rb +0 -21
  140. data/spec/support/ruby_interpreter.rb +0 -7
  141. data/spec/support/shared_example_groups/excon.rb +0 -63
  142. data/spec/support/shared_example_groups/hook_into_http_library.rb +0 -594
  143. data/spec/support/shared_example_groups/request_hooks.rb +0 -59
  144. data/spec/support/sinatra_app.rb +0 -86
  145. data/spec/support/vcr_localhost_server.rb +0 -76
  146. data/spec/support/vcr_stub_helpers.rb +0 -17
@@ -1,110 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://example.com:80/
6
- body:
7
- headers:
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- last-modified:
14
- - Tue, 15 Nov 2005 13:24:10 GMT
15
- connection:
16
- - Keep-Alive
17
- date:
18
- - Thu, 25 Feb 2010 07:52:38 GMT
19
- content-type:
20
- - text/html; charset=UTF-8
21
- etag:
22
- - "\"24ec5-1b6-4059a80bfd280\""
23
- server:
24
- - Apache/2.2.3 (CentOS)
25
- content-length:
26
- - "438"
27
- age:
28
- - "3009"
29
- accept-ranges:
30
- - bytes
31
- body: |
32
- <HTML>
33
- <HEAD>
34
- <TITLE>Example Web Page</TITLE>
35
- </HEAD>
36
- <body>
37
- <p>You have reached this web page by typing &quot;example.com&quot;,
38
- &quot;example.net&quot;,
39
- or &quot;example.org&quot; into your web browser.</p>
40
- <p>These domain names are reserved for use in documentation and are not available
41
- for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
42
- 2606</a>, Section 3.</p>
43
- </BODY>
44
- </HTML>
45
-
46
- http_version: "1.1"
47
- - !ruby/struct:VCR::HTTPInteraction
48
- request: !ruby/struct:VCR::Request
49
- method: :get
50
- uri: http://example.com:80/foo
51
- body:
52
- headers:
53
- response: !ruby/struct:VCR::Response
54
- status: !ruby/struct:VCR::ResponseStatus
55
- code: 404
56
- message: Not Found
57
- headers:
58
- connection:
59
- - close
60
- content-type:
61
- - text/html; charset=iso-8859-1
62
- date:
63
- - Thu, 25 Feb 2010 07:52:38 GMT
64
- server:
65
- - Apache/2.2.3 (CentOS)
66
- content-length:
67
- - "277"
68
- body: |
69
- <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
70
- <html><head>
71
- <title>404 Not Found</title>
72
- </head><body>
73
- <h1>Not Found</h1>
74
- <p>The requested URL /foo was not found on this server.</p>
75
- <hr>
76
- <address>Apache/2.2.3 (CentOS) Server at example.com Port 80</address>
77
- </body></html>
78
-
79
- http_version: "1.1"
80
- - !ruby/struct:VCR::HTTPInteraction
81
- request: !ruby/struct:VCR::Request
82
- method: :get
83
- uri: http://example.com:80/
84
- body:
85
- headers:
86
- response: !ruby/struct:VCR::Response
87
- status: !ruby/struct:VCR::ResponseStatus
88
- code: 200
89
- message: OK
90
- headers:
91
- last-modified:
92
- - Tue, 15 Nov 2005 13:24:10 GMT
93
- connection:
94
- - Keep-Alive
95
- date:
96
- - Thu, 25 Feb 2010 07:52:38 GMT
97
- content-type:
98
- - text/html; charset=UTF-8
99
- etag:
100
- - "\"24ec5-1b6-4059a80bfd280\""
101
- server:
102
- - Apache/2.2.3 (CentOS)
103
- content-length:
104
- - "438"
105
- age:
106
- - "3009"
107
- accept-ranges:
108
- - bytes
109
- body: Another example.com response
110
- http_version: "1.1"
File without changes
@@ -1,111 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://example.com/
6
- body: ''
7
- headers: {}
8
- response:
9
- status:
10
- code: 200
11
- message: OK
12
- headers:
13
- Last-Modified:
14
- - Tue, 15 Nov 2005 13:24:10 GMT
15
- Connection:
16
- - Keep-Alive
17
- Date:
18
- - Thu, 25 Feb 2010 07:52:38 GMT
19
- Content-Type:
20
- - text/html; charset=UTF-8
21
- Etag:
22
- - ! '"24ec5-1b6-4059a80bfd280"'
23
- Server:
24
- - Apache/2.2.3 (CentOS)
25
- Content-Length:
26
- - '438'
27
- Age:
28
- - '3009'
29
- Accept-Ranges:
30
- - bytes
31
- body: ! "<HTML>\n<HEAD>\n <TITLE>Example Web Page</TITLE>\n</HEAD> \n<body> \n<p>You
32
- have reached this web page by typing &quot;example.com&quot;,\n&quot;example.net&quot;,\n
33
- \ or &quot;example.org&quot; into your web browser.</p>\n<p>These domain names
34
- are reserved for use in documentation and are not available \n for registration.
35
- See <a href=\"http://www.rfc-editor.org/rfc/rfc2606.txt\">RFC \n 2606</a>,
36
- Section 3.</p>\n</BODY>\n</HTML>\n"
37
- http_version: '1.1'
38
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
39
- - request:
40
- method: get
41
- uri: http://example.com/foo
42
- body: ''
43
- headers: {}
44
- response:
45
- status:
46
- code: 404
47
- message: Not Found
48
- headers:
49
- Connection:
50
- - close
51
- Content-Type:
52
- - text/html; charset=iso-8859-1
53
- Date:
54
- - Thu, 25 Feb 2010 07:52:38 GMT
55
- Server:
56
- - Apache/2.2.3 (CentOS)
57
- Content-Length:
58
- - '277'
59
- body: ! '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
60
-
61
- <html><head>
62
-
63
- <title>404 Not Found</title>
64
-
65
- </head><body>
66
-
67
- <h1>Not Found</h1>
68
-
69
- <p>The requested URL /foo was not found on this server.</p>
70
-
71
- <hr>
72
-
73
- <address>Apache/2.2.3 (CentOS) Server at example.com Port 80</address>
74
-
75
- </body></html>
76
-
77
- '
78
- http_version: '1.1'
79
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
80
- - request:
81
- method: get
82
- uri: http://example.com/
83
- body: ''
84
- headers: {}
85
- response:
86
- status:
87
- code: 200
88
- message: OK
89
- headers:
90
- Last-Modified:
91
- - Tue, 15 Nov 2005 13:24:10 GMT
92
- Connection:
93
- - Keep-Alive
94
- Date:
95
- - Thu, 25 Feb 2010 07:52:38 GMT
96
- Content-Type:
97
- - text/html; charset=UTF-8
98
- Etag:
99
- - ! '"24ec5-1b6-4059a80bfd280"'
100
- Server:
101
- - Apache/2.2.3 (CentOS)
102
- Content-Length:
103
- - '438'
104
- Age:
105
- - '3009'
106
- Accept-Ranges:
107
- - bytes
108
- body: Another example.com response
109
- http_version: '1.1'
110
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
111
- recorded_with: VCR 2.0.0
@@ -1,111 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://localhost/
6
- body: ''
7
- headers: {}
8
- response:
9
- status:
10
- code: 200
11
- message: OK
12
- headers:
13
- Etag:
14
- - ! '"24ec5-1b6-4059a80bfd280"'
15
- Last-Modified:
16
- - Tue, 15 Nov 2005 13:24:10 GMT
17
- Connection:
18
- - Keep-Alive
19
- Content-Type:
20
- - text/html; charset=UTF-8
21
- Date:
22
- - Thu, 25 Feb 2010 07:53:51 GMT
23
- Server:
24
- - Apache/2.2.3 (CentOS)
25
- Content-Length:
26
- - '438'
27
- Age:
28
- - '9260'
29
- Accept-Ranges:
30
- - bytes
31
- body: Localhost response
32
- http_version: '1.1'
33
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
34
- - request:
35
- method: get
36
- uri: http://127.0.0.1/
37
- body: ''
38
- headers: {}
39
- response:
40
- status:
41
- code: 404
42
- message: Not Found
43
- headers:
44
- Content-Type:
45
- - text/html; charset=iso-8859-1
46
- Connection:
47
- - close
48
- Server:
49
- - Apache/2.2.3 (CentOS)
50
- Date:
51
- - Thu, 25 Feb 2010 07:53:52 GMT
52
- Content-Length:
53
- - '277'
54
- body: 127.0.0.1 response
55
- http_version: '1.1'
56
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
57
- - request:
58
- method: get
59
- uri: http://0.0.0.0/
60
- body: ''
61
- headers: {}
62
- response:
63
- status:
64
- code: 404
65
- message: Not Found
66
- headers:
67
- Content-Type:
68
- - text/html; charset=iso-8859-1
69
- Connection:
70
- - close
71
- Server:
72
- - Apache/2.2.3 (CentOS)
73
- Date:
74
- - Thu, 25 Feb 2010 07:53:52 GMT
75
- Content-Length:
76
- - '277'
77
- body: 127.0.0.1 response
78
- http_version: '1.1'
79
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
80
- - request:
81
- method: get
82
- uri: http://example.com/
83
- body: ''
84
- headers: {}
85
- response:
86
- status:
87
- code: 200
88
- message: OK
89
- headers:
90
- Etag:
91
- - ! '"24ec5-1b6-4059a80bfd280"'
92
- Last-Modified:
93
- - Tue, 15 Nov 2005 13:24:10 GMT
94
- Connection:
95
- - Keep-Alive
96
- Content-Type:
97
- - text/html; charset=UTF-8
98
- Date:
99
- - Thu, 25 Feb 2010 07:53:51 GMT
100
- Server:
101
- - Apache/2.2.3 (CentOS)
102
- Content-Length:
103
- - '438'
104
- Age:
105
- - '9260'
106
- Accept-Ranges:
107
- - bytes
108
- body: example.com response
109
- http_version: '1.1'
110
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
111
- recorded_with: VCR 1.11.3
@@ -1,110 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: http://example.com/foo
6
- body: ''
7
- headers: {}
8
- response:
9
- status:
10
- code: 200
11
- message: OK
12
- headers:
13
- Last-Modified:
14
- - Tue, 15 Nov 2005 13:24:10 GMT
15
- Connection:
16
- - Keep-Alive
17
- Etag:
18
- - ! '"24ec5-1b6-4059a80bfd280"'
19
- Content-Type:
20
- - text/html; charset=UTF-8
21
- Date:
22
- - Wed, 31 Mar 2010 02:43:23 GMT
23
- Server:
24
- - Apache/2.2.3 (CentOS)
25
- Content-Length:
26
- - '438'
27
- Age:
28
- - '3285'
29
- Accept-Ranges:
30
- - bytes
31
- body: example.com get response 1 with path=foo
32
- http_version: '1.1'
33
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
34
- - request:
35
- method: get
36
- uri: http://example.com/foo
37
- body: ''
38
- headers: {}
39
- response:
40
- status:
41
- code: 200
42
- message: OK
43
- headers:
44
- Last-Modified:
45
- - Tue, 15 Nov 2005 13:24:10 GMT
46
- Connection:
47
- - Keep-Alive
48
- Etag:
49
- - ! '"24ec5-1b6-4059a80bfd280"'
50
- Content-Type:
51
- - text/html; charset=UTF-8
52
- Date:
53
- - Wed, 31 Mar 2010 02:43:23 GMT
54
- Server:
55
- - Apache/2.2.3 (CentOS)
56
- Content-Length:
57
- - '438'
58
- Age:
59
- - '3285'
60
- Accept-Ranges:
61
- - bytes
62
- body: example.com get response 2 with path=foo
63
- http_version: '1.1'
64
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
65
- - request:
66
- method: post
67
- uri: http://example.com/
68
- body: ''
69
- headers: {}
70
- response:
71
- status:
72
- code: 200
73
- message: OK
74
- headers:
75
- Last-Modified:
76
- - Tue, 15 Nov 2005 13:24:10 GMT
77
- Connection:
78
- - close
79
- Etag:
80
- - ! '"24ec5-1b6-4059a80bfd280"'
81
- Content-Type:
82
- - text/html; charset=UTF-8
83
- Date:
84
- - Wed, 31 Mar 2010 02:43:26 GMT
85
- Server:
86
- - Apache/2.2.3 (CentOS)
87
- Content-Length:
88
- - '438'
89
- Accept-Ranges:
90
- - bytes
91
- body: example.com post response with id=3
92
- http_version: '1.1'
93
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
94
- - request:
95
- method: get
96
- uri: http://example.com/two_set_cookie_headers
97
- body: ''
98
- headers: {}
99
- response:
100
- status:
101
- code: 200
102
- message: OK
103
- headers:
104
- Set-Cookie:
105
- - bar=bazz
106
- - foo=bar
107
- body: this respons has two set-cookie headers
108
- http_version: '1.1'
109
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
110
- recorded_with: VCR 1.11.3
@@ -1,187 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://example.com/method
6
- body: ''
7
- headers: {}
8
- response:
9
- status:
10
- code: 200
11
- message: OK
12
- headers:
13
- Etag:
14
- - ! '"24ec5-1b6-4059a80bfd280"'
15
- body: post method response
16
- http_version: '1.1'
17
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
18
- - request:
19
- method: get
20
- uri: http://example.com/method
21
- body: ''
22
- headers: {}
23
- response:
24
- status:
25
- code: 200
26
- message: OK
27
- headers:
28
- Etag:
29
- - ! '"24ec5-1b6-4059a80bfd280"'
30
- body: get method response
31
- http_version: '1.1'
32
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
33
- - request:
34
- method: post
35
- uri: http://example1.com/host
36
- body: ''
37
- headers: {}
38
- response:
39
- status:
40
- code: 200
41
- message: OK
42
- headers:
43
- Etag:
44
- - ! '"24ec5-1b6-4059a80bfd280"'
45
- body: example1.com host response
46
- http_version: '1.1'
47
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
48
- - request:
49
- method: post
50
- uri: http://example2.com/host
51
- body: ''
52
- headers: {}
53
- response:
54
- status:
55
- code: 200
56
- message: OK
57
- headers:
58
- Etag:
59
- - ! '"24ec5-1b6-4059a80bfd280"'
60
- body: example2.com host response
61
- http_version: '1.1'
62
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
63
- - request:
64
- method: post
65
- uri: http://example.com/path1
66
- body: ''
67
- headers: {}
68
- response:
69
- status:
70
- code: 200
71
- message: OK
72
- headers:
73
- Etag:
74
- - ! '"24ec5-1b6-4059a80bfd280"'
75
- body: path1 response
76
- http_version: '1.1'
77
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
78
- - request:
79
- method: post
80
- uri: http://example.com/path2
81
- body: ''
82
- headers: {}
83
- response:
84
- status:
85
- code: 200
86
- message: OK
87
- headers:
88
- Etag:
89
- - ! '"24ec5-1b6-4059a80bfd280"'
90
- body: path2 response
91
- http_version: '1.1'
92
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
93
- - request:
94
- method: post
95
- uri: http://example.com/uri1
96
- body: ''
97
- headers: {}
98
- response:
99
- status:
100
- code: 200
101
- message: OK
102
- headers:
103
- Etag:
104
- - ! '"24ec5-1b6-4059a80bfd280"'
105
- body: uri1 response
106
- http_version: '1.1'
107
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
108
- - request:
109
- method: post
110
- uri: http://example.com/uri2
111
- body: ''
112
- headers: {}
113
- response:
114
- status:
115
- code: 200
116
- message: OK
117
- headers:
118
- Etag:
119
- - ! '"24ec5-1b6-4059a80bfd280"'
120
- body: uri2 response
121
- http_version: '1.1'
122
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
123
- - request:
124
- method: post
125
- uri: http://example.com/
126
- body: param=val1
127
- headers: {}
128
- response:
129
- status:
130
- code: 200
131
- message: OK
132
- headers:
133
- Etag:
134
- - ! '"24ec5-1b6-4059a80bfd280"'
135
- body: val1 body response
136
- http_version: '1.1'
137
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
138
- - request:
139
- method: post
140
- uri: http://example.com/
141
- body: param=val2
142
- headers: {}
143
- response:
144
- status:
145
- code: 200
146
- message: OK
147
- headers:
148
- Etag:
149
- - ! '"24ec5-1b6-4059a80bfd280"'
150
- body: val2 body response
151
- http_version: '1.1'
152
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
153
- - request:
154
- method: post
155
- uri: http://example.com/
156
- body: ''
157
- headers:
158
- X-Http-Header1:
159
- - val1
160
- response:
161
- status:
162
- code: 200
163
- message: OK
164
- headers:
165
- Etag:
166
- - ! '"24ec5-1b6-4059a80bfd280"'
167
- body: val1 header response
168
- http_version: '1.1'
169
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
170
- - request:
171
- method: post
172
- uri: http://example.com/
173
- body: ''
174
- headers:
175
- X-Http-Header1:
176
- - val2
177
- response:
178
- status:
179
- code: 200
180
- message: OK
181
- headers:
182
- Etag:
183
- - ! '"24ec5-1b6-4059a80bfd280"'
184
- body: val2 header response
185
- http_version: '1.1'
186
- recorded_at: Tue, 01 Nov 2011 04:49:54 GMT
187
- recorded_with: VCR 1.11.3
@@ -1,53 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe VCR::Cassette::ERBRenderer do
4
- describe '#render' do
5
- def render(*args)
6
- described_class.new(*args).render
7
- end
8
-
9
- let(:no_vars_content) { '<%= 3 + 4 %>. Some ERB' }
10
- let(:vars_content) { '<%= var1 %>. ERB with Vars! <%= var2 %>' }
11
-
12
- context 'when ERB is disabled' do
13
- it 'returns the given template' do
14
- expect(render(no_vars_content, false)).to eq(no_vars_content)
15
- expect(render(no_vars_content, nil)).to eq(no_vars_content)
16
- end
17
- end
18
-
19
- context 'when ERB is enabled but no variables are passed' do
20
- it 'renders the file content as ERB' do
21
- expect(render(no_vars_content, true)).to eq("7. Some ERB")
22
- end
23
-
24
- it 'raises an appropriate error when the ERB template needs variables' do
25
- expect {
26
- render(vars_content, true, "vars")
27
- }.to raise_error(VCR::Errors::MissingERBVariableError,
28
- %{The ERB in the vars cassette file references undefined variable var1. } +
29
- %{Pass it to the cassette using :erb => #{ {:var1=>"some value"}.inspect }.}
30
- )
31
- end
32
-
33
- it 'gracefully handles the template being nil' do
34
- expect(render(nil, true)).to be_nil
35
- end
36
- end
37
-
38
- context 'when ERB is enabled and variables are passed' do
39
- it 'renders the file content as ERB with the passed variables' do
40
- expect(render(vars_content, :var1 => 'foo', :var2 => 'bar')).to eq('foo. ERB with Vars! bar')
41
- end
42
-
43
- it 'raises an appropriate error when one or more of the needed variables are not passed' do
44
- expect {
45
- render(vars_content, { :var1 => 'foo' }, "vars")
46
- }.to raise_error(VCR::Errors::MissingERBVariableError,
47
- %{The ERB in the vars cassette file references undefined variable var2. } +
48
- %{Pass it to the cassette using :erb => #{ {:var1 => "foo", :var2 => "some value"}.inspect }.}
49
- )
50
- end
51
- end
52
- end
53
- end