vcr 3.0.3 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vcr.rb +18 -1
  3. data/lib/vcr/cassette.rb +11 -3
  4. data/lib/vcr/cassette/persisters/file_system.rb +1 -1
  5. data/lib/vcr/configuration.rb +3 -5
  6. data/lib/vcr/deprecations.rb +0 -62
  7. data/lib/vcr/errors.rb +16 -0
  8. data/lib/vcr/library_hooks/typhoeus.rb +37 -8
  9. data/lib/vcr/middleware/faraday.rb +5 -1
  10. data/lib/vcr/structs.rb +1 -1
  11. data/lib/vcr/util/hooks.rb +1 -0
  12. data/lib/vcr/version.rb +1 -1
  13. metadata +9 -249
  14. data/features/CHANGELOG.md +0 -710
  15. data/features/CONTRIBUTING.md +0 -26
  16. data/features/LICENSE.md +0 -20
  17. data/features/README.md +0 -339
  18. data/features/Upgrade.md +0 -289
  19. data/features/about_these_examples.md +0 -18
  20. data/features/cassettes/allow_unused_http_interactions.feature +0 -100
  21. data/features/cassettes/automatic_re_recording.feature +0 -72
  22. data/features/cassettes/decompress.feature +0 -74
  23. data/features/cassettes/dynamic_erb.feature +0 -100
  24. data/features/cassettes/exclusive.feature +0 -126
  25. data/features/cassettes/format.feature +0 -411
  26. data/features/cassettes/freezing_time.feature +0 -68
  27. data/features/cassettes/naming.feature +0 -28
  28. data/features/cassettes/no_cassette.feature +0 -152
  29. data/features/cassettes/update_content_length_header.feature +0 -112
  30. data/features/configuration/allow_http_connections_when_no_cassette.feature +0 -55
  31. data/features/configuration/cassette_library_dir.feature +0 -31
  32. data/features/configuration/debug_logging.feature +0 -58
  33. data/features/configuration/default_cassette_options.feature +0 -100
  34. data/features/configuration/filter_sensitive_data.feature +0 -153
  35. data/features/configuration/hook_into.feature +0 -172
  36. data/features/configuration/ignore_request.feature +0 -192
  37. data/features/configuration/preserve_exact_body_bytes.feature +0 -108
  38. data/features/configuration/query_parser.feature +0 -84
  39. data/features/configuration/uri_parser.feature +0 -93
  40. data/features/getting_started.md +0 -82
  41. data/features/hooks/after_http_request.feature +0 -58
  42. data/features/hooks/around_http_request.feature +0 -57
  43. data/features/hooks/before_http_request.feature +0 -63
  44. data/features/hooks/before_playback.feature +0 -184
  45. data/features/hooks/before_record.feature +0 -172
  46. data/features/http_libraries/em_http_request.feature +0 -250
  47. data/features/http_libraries/net_http.feature +0 -179
  48. data/features/middleware/faraday.feature +0 -56
  49. data/features/middleware/rack.feature +0 -92
  50. data/features/record_modes/all.feature +0 -82
  51. data/features/record_modes/new_episodes.feature +0 -79
  52. data/features/record_modes/none.feature +0 -72
  53. data/features/record_modes/once.feature +0 -95
  54. data/features/request_matching/README.md +0 -30
  55. data/features/request_matching/body.feature +0 -91
  56. data/features/request_matching/body_as_json.feature +0 -90
  57. data/features/request_matching/custom_matcher.feature +0 -135
  58. data/features/request_matching/headers.feature +0 -85
  59. data/features/request_matching/host.feature +0 -95
  60. data/features/request_matching/identical_request_sequence.feature +0 -89
  61. data/features/request_matching/method.feature +0 -96
  62. data/features/request_matching/path.feature +0 -96
  63. data/features/request_matching/playback_repeats.feature +0 -98
  64. data/features/request_matching/query.feature +0 -97
  65. data/features/request_matching/uri.feature +0 -94
  66. data/features/request_matching/uri_without_param.feature +0 -101
  67. data/features/step_definitions/cli_steps.rb +0 -199
  68. data/features/support/env.rb +0 -46
  69. data/features/support/http_lib_filters.rb +0 -46
  70. data/features/test_frameworks/cucumber.feature +0 -211
  71. data/features/test_frameworks/rspec_macro.feature +0 -81
  72. data/features/test_frameworks/rspec_metadata.feature +0 -150
  73. data/features/test_frameworks/test_unit.feature +0 -49
  74. data/lib/vcr/extensions/net_http_response.rb +0 -36
  75. data/lib/vcr/library_hooks/fakeweb.rb +0 -197
  76. data/spec/acceptance/concurrency_spec.rb +0 -51
  77. data/spec/acceptance/threading_spec.rb +0 -34
  78. data/spec/fixtures/cassette_spec/1_x_cassette.yml +0 -110
  79. data/spec/fixtures/cassette_spec/empty.yml +0 -0
  80. data/spec/fixtures/cassette_spec/example.yml +0 -111
  81. data/spec/fixtures/cassette_spec/with_localhost_requests.yml +0 -111
  82. data/spec/fixtures/fake_example_responses.yml +0 -110
  83. data/spec/fixtures/match_requests_on.yml +0 -187
  84. data/spec/lib/vcr/cassette/erb_renderer_spec.rb +0 -53
  85. data/spec/lib/vcr/cassette/http_interaction_list_spec.rb +0 -295
  86. data/spec/lib/vcr/cassette/migrator_spec.rb +0 -196
  87. data/spec/lib/vcr/cassette/persisters/file_system_spec.rb +0 -75
  88. data/spec/lib/vcr/cassette/persisters_spec.rb +0 -39
  89. data/spec/lib/vcr/cassette/serializers_spec.rb +0 -182
  90. data/spec/lib/vcr/cassette_spec.rb +0 -618
  91. data/spec/lib/vcr/configuration_spec.rb +0 -326
  92. data/spec/lib/vcr/deprecations_spec.rb +0 -85
  93. data/spec/lib/vcr/errors_spec.rb +0 -178
  94. data/spec/lib/vcr/extensions/net_http_response_spec.rb +0 -86
  95. data/spec/lib/vcr/library_hooks/excon_spec.rb +0 -104
  96. data/spec/lib/vcr/library_hooks/fakeweb_spec.rb +0 -169
  97. data/spec/lib/vcr/library_hooks/faraday_spec.rb +0 -68
  98. data/spec/lib/vcr/library_hooks/typhoeus_0.4_spec.rb +0 -36
  99. data/spec/lib/vcr/library_hooks/typhoeus_spec.rb +0 -162
  100. data/spec/lib/vcr/library_hooks/webmock_spec.rb +0 -117
  101. data/spec/lib/vcr/library_hooks_spec.rb +0 -51
  102. data/spec/lib/vcr/middleware/faraday_spec.rb +0 -181
  103. data/spec/lib/vcr/middleware/rack_spec.rb +0 -115
  104. data/spec/lib/vcr/request_ignorer_spec.rb +0 -70
  105. data/spec/lib/vcr/request_matcher_registry_spec.rb +0 -345
  106. data/spec/lib/vcr/structs_spec.rb +0 -732
  107. data/spec/lib/vcr/test_frameworks/cucumber_spec.rb +0 -107
  108. data/spec/lib/vcr/test_frameworks/rspec_spec.rb +0 -94
  109. data/spec/lib/vcr/util/hooks_spec.rb +0 -158
  110. data/spec/lib/vcr/util/internet_connection_spec.rb +0 -37
  111. data/spec/lib/vcr/util/version_checker_spec.rb +0 -31
  112. data/spec/lib/vcr/version_spec.rb +0 -27
  113. data/spec/lib/vcr_spec.rb +0 -354
  114. data/spec/monkey_patches.rb +0 -186
  115. data/spec/spec_helper.rb +0 -63
  116. data/spec/support/configuration_stubbing.rb +0 -8
  117. data/spec/support/cucumber_helpers.rb +0 -39
  118. data/spec/support/fixnum_extension.rb +0 -10
  119. data/spec/support/http_library_adapters.rb +0 -289
  120. data/spec/support/limited_uri.rb +0 -21
  121. data/spec/support/ruby_interpreter.rb +0 -7
  122. data/spec/support/shared_example_groups/excon.rb +0 -63
  123. data/spec/support/shared_example_groups/hook_into_http_library.rb +0 -594
  124. data/spec/support/shared_example_groups/request_hooks.rb +0 -59
  125. data/spec/support/sinatra_app.rb +0 -86
  126. data/spec/support/vcr_localhost_server.rb +0 -76
  127. data/spec/support/vcr_stub_helpers.rb +0 -17
@@ -1,179 +0,0 @@
1
- Feature: Net::HTTP
2
-
3
- There are many ways to use Net::HTTP. The scenarios below provide regression
4
- tests for some Net::HTTP APIs that have not worked properly with VCR and
5
- FakeWeb or WebMock in the past (but have since been fixed).
6
-
7
- Background:
8
- Given a file named "vcr_setup.rb" with:
9
- """ruby
10
- require 'ostruct'
11
-
12
- if ARGV[0] == '--with-server'
13
- $server = start_sinatra_app do
14
- get('/') { 'VCR works with Net::HTTP gets!' }
15
- post('/') { 'VCR works with Net::HTTP posts!' }
16
- end
17
- else
18
- $server = OpenStruct(:port => 0)
19
- end
20
-
21
- require 'vcr'
22
-
23
- VCR.configure do |c|
24
- c.default_cassette_options = {
25
- :match_requests_on => [:method, :host, :path]
26
- }
27
- end
28
- """
29
-
30
- Scenario Outline: Calling #post on new Net::HTTP instance
31
- Given a file named "vcr_net_http.rb" with:
32
- """ruby
33
- require 'vcr_setup.rb'
34
-
35
- VCR.configure do |c|
36
- c.hook_into <hook_into>
37
- c.cassette_library_dir = 'cassettes'
38
- end
39
-
40
- VCR.use_cassette('net_http') do
41
- puts Net::HTTP.new('localhost', $server.port).post('/', '').body
42
- end
43
- """
44
- When I run `ruby vcr_net_http.rb --with-server`
45
- Then the output should contain "VCR works with Net::HTTP posts!"
46
- And the file "cassettes/net_http.yml" should contain "VCR works with Net::HTTP posts!"
47
-
48
- When I run `ruby vcr_net_http.rb`
49
- Then the output should contain "VCR works with Net::HTTP posts!"
50
-
51
- Examples:
52
- | hook_into |
53
- | :fakeweb |
54
- | :webmock |
55
-
56
- Scenario Outline: Return from yielded block
57
- Given a file named "vcr_net_http.rb" with:
58
- """ruby
59
- require 'vcr_setup.rb'
60
-
61
- VCR.configure do |c|
62
- c.hook_into <hook_into>
63
- c.cassette_library_dir = 'cassettes'
64
- end
65
-
66
- def perform_request
67
- Net::HTTP.new('localhost', $server.port).request(Net::HTTP::Get.new('/', {})) do |response|
68
- return response
69
- end
70
- end
71
-
72
- VCR.use_cassette('net_http') do
73
- puts perform_request.body
74
- end
75
- """
76
- When I run `ruby vcr_net_http.rb --with-server`
77
- Then the output should contain "VCR works with Net::HTTP gets!"
78
- And the file "cassettes/net_http.yml" should contain "VCR works with Net::HTTP gets!"
79
-
80
- When I run `ruby vcr_net_http.rb`
81
- Then the output should contain "VCR works with Net::HTTP gets!"
82
-
83
- Examples:
84
- | hook_into |
85
- | :fakeweb |
86
- | :webmock |
87
-
88
- Scenario Outline: Use Net::ReadAdapter to read body in fragments
89
- Given a file named "vcr_net_http.rb" with:
90
- """ruby
91
- require 'vcr_setup.rb'
92
-
93
- VCR.configure do |c|
94
- c.hook_into <hook_into>
95
- c.cassette_library_dir = 'cassettes'
96
- end
97
-
98
- VCR.use_cassette('net_http') do
99
- body = ''
100
-
101
- Net::HTTP.new('localhost', $server.port).request_get('/') do |response|
102
- response.read_body { |frag| body << frag }
103
- end
104
-
105
- puts body
106
- end
107
- """
108
- When I run `ruby vcr_net_http.rb --with-server`
109
- Then the output should contain "VCR works with Net::HTTP gets!"
110
- And the file "cassettes/net_http.yml" should contain "VCR works with Net::HTTP gets!"
111
-
112
- When I run `ruby vcr_net_http.rb`
113
- Then the output should contain "VCR works with Net::HTTP gets!"
114
-
115
- Examples:
116
- | hook_into |
117
- | :fakeweb |
118
- | :webmock |
119
-
120
- Scenario Outline: Use open-uri (which is built on top of Net::HTTP and uses a seldom-used Net::HTTP API)
121
- Given a file named "vcr_net_http.rb" with:
122
- """ruby
123
- require 'open-uri'
124
- require 'vcr_setup.rb'
125
-
126
- VCR.configure do |c|
127
- c.hook_into <hook_into>
128
- c.cassette_library_dir = 'cassettes'
129
- end
130
-
131
- VCR.use_cassette('net_http') do
132
- puts open("http://localhost:#{$server.port}/").read
133
- end
134
- """
135
- When I run `ruby vcr_net_http.rb --with-server`
136
- Then the output should contain "VCR works with Net::HTTP gets!"
137
- And the file "cassettes/net_http.yml" should contain "VCR works with Net::HTTP gets!"
138
-
139
- When I run `ruby vcr_net_http.rb`
140
- Then the output should contain "VCR works with Net::HTTP gets!"
141
-
142
- Examples:
143
- | hook_into |
144
- | :fakeweb |
145
- | :webmock |
146
-
147
- Scenario Outline: Make an HTTPS request
148
- Given a file named "vcr_https.rb" with:
149
- """ruby
150
- require 'vcr'
151
-
152
- VCR.configure do |c|
153
- c.hook_into <hook_into>
154
- c.cassette_library_dir = 'cassettes'
155
- end
156
-
157
- uri = URI("https://gist.githubusercontent.com/myronmarston/fb555cb593f3349d53af/raw/6921dd638337d3f6a51b0e02e7f30e3c414f70d6/vcr_gist")
158
-
159
- VCR.use_cassette('https') do
160
- http = Net::HTTP.new(uri.host, uri.port)
161
- http.use_ssl = true
162
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
163
- response = http.request_get(uri.path)
164
-
165
- puts response.body
166
- end
167
- """
168
- When I run `ruby vcr_https.rb`
169
- Then the output should contain "VCR gist"
170
- And the file "cassettes/https.yml" should contain "VCR gist"
171
-
172
- When I modify the file "cassettes/https.yml" to replace "VCR gist" with "HTTPS replaying works"
173
- And I run `ruby vcr_https.rb`
174
- Then the output should contain "HTTPS replaying works"
175
-
176
- Examples:
177
- | hook_into |
178
- | :fakeweb |
179
- | :webmock |
@@ -1,56 +0,0 @@
1
- Feature: Faraday middleware
2
-
3
- VCR provides middleware that can be used with Faraday. You can use this as
4
- an alternative to Faraday's built-in test adapter.
5
-
6
- VCR will automatically insert this middleware in the Faraday stack
7
- when you configure `hook_into :faraday`. However, if you want to control
8
- where the middleware goes in the faraday stack, you can use it yourself.
9
- The middleware should come before the Faraday HTTP adapter.
10
-
11
- Note that when you use the middleware directly, you don't need to configure
12
- `hook_into :faraday`.
13
-
14
- Scenario Outline: Use Faraday middleware
15
- Given a file named "faraday_example.rb" with:
16
- """ruby
17
- request_count = 0
18
- $server = start_sinatra_app do
19
- get('/:path') { "Hello #{params[:path]} #{request_count += 1}" }
20
- end
21
-
22
- require 'faraday'
23
- require 'vcr'
24
- <extra_require>
25
-
26
- VCR.configure do |c|
27
- c.default_cassette_options = { :serialize_with => :syck }
28
- c.cassette_library_dir = 'cassettes'
29
- end
30
-
31
- conn = Faraday::Connection.new(:url => "http://localhost:#{$server.port}") do |builder|
32
- builder.use VCR::Middleware::Faraday
33
- builder.adapter :<adapter>
34
- end
35
-
36
- VCR.use_cassette('example') do
37
- puts "Response 1: #{conn.get('/foo').body}"
38
- end
39
-
40
- VCR.use_cassette('example') do
41
- puts "Response 2: #{conn.get('/foo').body}"
42
- end
43
- """
44
- When I run `ruby faraday_example.rb`
45
- Then the output should contain:
46
- """
47
- Response 1: Hello foo 1
48
- Response 2: Hello foo 1
49
- """
50
- And the file "cassettes/example.yml" should contain "Hello foo 1"
51
-
52
- Examples:
53
- | adapter | extra_require |
54
- | net_http | |
55
- | typhoeus | require 'typhoeus/adapters/faraday' |
56
-
@@ -1,92 +0,0 @@
1
- Feature: Rack
2
-
3
- VCR provides a rack middleware that uses a cassette for the duration of
4
- a request. Simply provide `VCR::Middleware::Rack` with a block that sets
5
- the cassette name and options. You can set these based on the rack env
6
- if your block accepts two arguments.
7
-
8
- This is useful in a couple different ways:
9
-
10
- - In a rails app, you could use this to log all HTTP API calls made by
11
- the rails app (using the `:all` record mode). Of course, this will only
12
- record HTTP API calls made in the request-response cycle--API calls that
13
- are offloaded to a background job will not be logged.
14
- - This can be used as middleware in a simple rack HTTP proxy, to record
15
- and replay the proxied requests.
16
-
17
- Background:
18
- Given a file named "remote_server.rb" with:
19
- """ruby
20
- request_count = 0
21
- $server = start_sinatra_app do
22
- get('/:path') { "Hello #{params[:path]} #{request_count += 1}" }
23
- end
24
- """
25
- And a file named "client.rb" with:
26
- """ruby
27
- require 'remote_server'
28
- require 'proxy_server'
29
- require 'cgi'
30
-
31
- url = URI.parse("http://localhost:#{$proxy.port}?url=#{CGI.escape("http://localhost:#{$server.port}/foo")}")
32
-
33
- puts "Response 1: #{Net::HTTP.get_response(url).body}"
34
- puts "Response 2: #{Net::HTTP.get_response(url).body}"
35
- """
36
- And the directory "cassettes" does not exist
37
-
38
- Scenario: Use VCR rack middleware to record HTTP responses for a simple rack proxy app
39
- Given a file named "proxy_server.rb" with:
40
- """ruby
41
- require 'vcr'
42
-
43
- $proxy = start_sinatra_app do
44
- use VCR::Middleware::Rack do |cassette|
45
- cassette.name 'proxied'
46
- cassette.options :record => :new_episodes
47
- end
48
-
49
- get('/') { Net::HTTP.get_response(URI.parse(params[:url])).body }
50
- end
51
-
52
- VCR.configure do |c|
53
- c.cassette_library_dir = 'cassettes'
54
- c.hook_into :webmock
55
- c.allow_http_connections_when_no_cassette = true
56
- end
57
- """
58
- When I run `ruby client.rb`
59
- Then the output should contain:
60
- """
61
- Response 1: Hello foo 1
62
- Response 2: Hello foo 1
63
- """
64
- And the file "cassettes/proxied.yml" should contain "Hello foo 1"
65
-
66
- Scenario: Set cassette name based on rack request env
67
- Given a file named "proxy_server.rb" with:
68
- """ruby
69
- require 'vcr'
70
-
71
- $proxy = start_sinatra_app do
72
- use VCR::Middleware::Rack do |cassette, env|
73
- cassette.name env['SERVER_NAME']
74
- end
75
-
76
- get('/') { Net::HTTP.get_response(URI.parse(params[:url])).body }
77
- end
78
-
79
- VCR.configure do |c|
80
- c.cassette_library_dir = 'cassettes'
81
- c.hook_into :webmock
82
- c.allow_http_connections_when_no_cassette = true
83
- end
84
- """
85
- When I run `ruby client.rb`
86
- Then the output should contain:
87
- """
88
- Response 1: Hello foo 1
89
- Response 2: Hello foo 1
90
- """
91
- And the file "cassettes/localhost.yml" should contain "Hello foo 1"
92
-
@@ -1,82 +0,0 @@
1
- Feature: :all
2
-
3
- The `:all` record mode will:
4
-
5
- - Record new interactions.
6
- - Never replay previously recorded interactions.
7
-
8
- This can be temporarily used to force VCR to re-record
9
- a cassette (i.e. to ensure the responses are not out of date)
10
- or can be used when you simply want to log all HTTP requests.
11
-
12
- Background:
13
- Given a file named "setup.rb" with:
14
- """ruby
15
- $server = start_sinatra_app do
16
- get('/') { 'Hello' }
17
- get('/foo') { 'Goodbye' }
18
- end
19
-
20
- require 'vcr'
21
-
22
- VCR.configure do |c|
23
- c.hook_into :webmock
24
- c.cassette_library_dir = 'cassettes'
25
- end
26
- """
27
- And a previously recorded cassette file "cassettes/example.yml" with:
28
- """
29
- ---
30
- http_interactions:
31
- - request:
32
- method: get
33
- uri: http://localhost/
34
- body:
35
- encoding: UTF-8
36
- string: ""
37
- headers: {}
38
- response:
39
- status:
40
- code: 200
41
- message: OK
42
- headers:
43
- Content-Length:
44
- - "20"
45
- body:
46
- encoding: UTF-8
47
- string: old response
48
- http_version: "1.1"
49
- recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
50
- recorded_with: VCR 2.0.0
51
- """
52
-
53
- Scenario: Re-record previously recorded response
54
- Given a file named "re_record.rb" with:
55
- """ruby
56
- require 'setup'
57
-
58
- VCR.use_cassette('example', :record => :all, :match_requests_on => [:method, :host, :path]) do
59
- response = Net::HTTP.get_response('localhost', '/', $server.port)
60
- puts "Response: #{response.body}"
61
- end
62
- """
63
- When I run `ruby re_record.rb`
64
- Then it should pass with "Response: Hello"
65
- And the file "cassettes/example.yml" should contain "Hello"
66
- But the file "cassettes/example.yml" should not contain "old response"
67
-
68
- Scenario: Record new request
69
- Given a file named "record_new.rb" with:
70
- """ruby
71
- require 'setup'
72
-
73
- VCR.use_cassette('example', :record => :all) do
74
- response = Net::HTTP.get_response('localhost', '/foo', $server.port)
75
- puts "Response: #{response.body}"
76
- end
77
- """
78
- When I run `ruby record_new.rb`
79
- Then it should pass with "Response: Goodbye"
80
- And the file "cassettes/example.yml" should contain each of these:
81
- | old response |
82
- | Goodbye |
@@ -1,79 +0,0 @@
1
- Feature: :new_episodes
2
-
3
- The `:new_episodes` record mode will:
4
-
5
- - Record new interactions.
6
- - Replay previously recorded interactions.
7
-
8
- It is similar to the `:once` record mode, but will _always_ record new
9
- interactions, even if you have an existing recorded one that is similar
10
- (but not identical, based on the `:match_request_on` option).
11
-
12
- Background:
13
- Given a file named "setup.rb" with:
14
- """ruby
15
- $server = start_sinatra_app do
16
- get('/') { 'Hello' }
17
- end
18
-
19
- require 'vcr'
20
-
21
- VCR.configure do |c|
22
- c.hook_into :webmock
23
- c.cassette_library_dir = 'cassettes'
24
- end
25
- """
26
- And a previously recorded cassette file "cassettes/example.yml" with:
27
- """
28
- ---
29
- http_interactions:
30
- - request:
31
- method: get
32
- uri: http://example.com/foo
33
- body:
34
- encoding: UTF-8
35
- string: ""
36
- headers: {}
37
- response:
38
- status:
39
- code: 200
40
- message: OK
41
- headers:
42
- Content-Length:
43
- - "20"
44
- body:
45
- encoding: UTF-8
46
- string: example.com response
47
- http_version: "1.1"
48
- recorded_at: Tue, 01 Nov 2011 04:58:44 GMT
49
- recorded_with: VCR 2.0.0
50
- """
51
-
52
- Scenario: Previously recorded responses are replayed
53
- Given a file named "replay_recorded_response.rb" with:
54
- """ruby
55
- require 'setup'
56
-
57
- VCR.use_cassette('example', :record => :new_episodes) do
58
- response = Net::HTTP.get_response('example.com', '/foo')
59
- puts "Response: #{response.body}"
60
- end
61
- """
62
- When I run `ruby replay_recorded_response.rb`
63
- Then it should pass with "Response: example.com response"
64
-
65
- Scenario: New requests get recorded
66
- Given a file named "record_new_requests.rb" with:
67
- """ruby
68
- require 'setup'
69
-
70
- VCR.use_cassette('example', :record => :new_episodes) do
71
- response = Net::HTTP.get_response('localhost', '/', $server.port)
72
- puts "Response: #{response.body}"
73
- end
74
- """
75
- When I run `ruby record_new_requests.rb`
76
- Then it should pass with "Response: Hello"
77
- And the file "cassettes/example.yml" should contain each of these:
78
- | example.com response |
79
- | Hello |