vcr 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +3 -0
- data/CHANGELOG.md +11 -4
- data/Gemfile +5 -4
- data/Rakefile +23 -4
- data/cucumber.yml +2 -2
- data/features/cassettes/automatic_re_recording.feature +2 -2
- data/features/cassettes/dynamic_erb.feature +2 -2
- data/features/cassettes/format.feature +1 -1
- data/features/cassettes/naming.feature +1 -1
- data/features/cassettes/no_cassette.feature +4 -4
- data/features/cassettes/request_matching.feature +5 -5
- data/features/cassettes/update_content_length_header.feature +3 -3
- data/features/configuration/allow_http_connections_when_no_cassette.feature +3 -3
- data/features/configuration/cassette_library_dir.feature +1 -1
- data/features/configuration/default_cassette_options.feature +5 -5
- data/features/configuration/filter_sensitive_data.feature +6 -6
- data/features/configuration/hooks.feature +6 -6
- data/features/configuration/ignore_hosts.feature +1 -1
- data/features/configuration/ignore_localhost.feature +2 -2
- data/features/configuration/stub_with.feature +4 -4
- data/features/http_libraries/em_http_request.feature +4 -4
- data/features/http_libraries/net_http.feature +10 -10
- data/features/middleware/faraday.feature +2 -2
- data/features/middleware/rack.feature +2 -2
- data/features/record_modes/all.feature +2 -2
- data/features/record_modes/new_episodes.feature +2 -2
- data/features/record_modes/none.feature +2 -2
- data/features/record_modes/once.feature +3 -3
- data/features/step_definitions/cli_steps.rb +6 -2
- data/features/support/env.rb +5 -8
- data/features/support/http_lib_filters.rb +6 -1
- data/features/test_frameworks/cucumber.feature +2 -2
- data/features/test_frameworks/rspec.feature +2 -2
- data/features/test_frameworks/shoulda.feature +13 -10
- data/features/test_frameworks/test_unit.feature +12 -9
- data/lib/vcr.rb +6 -0
- data/lib/vcr/config.rb +7 -1
- data/lib/vcr/deprecations/cassette.rb +16 -16
- data/lib/vcr/extensions/net_http_response.rb +4 -0
- data/lib/vcr/http_stubbing_adapters/common.rb +1 -1
- data/lib/vcr/http_stubbing_adapters/fakeweb.rb +6 -0
- data/lib/vcr/http_stubbing_adapters/webmock.rb +7 -0
- data/lib/vcr/middleware/cassette_arguments.rb +1 -0
- data/lib/vcr/structs/http_interaction.rb +1 -0
- data/lib/vcr/version.rb +1 -1
- data/spec/capture_warnings.rb +42 -0
- data/spec/monkey_patches.rb +5 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/support/shared_example_groups/http_library.rb +19 -19
- data/spec/support/shared_example_groups/http_stubbing_adapter.rb +6 -6
- data/spec/support/shared_example_groups/ignore_localhost_deprecation.rb +1 -1
- data/spec/support/shared_example_groups/normalizers.rb +13 -15
- data/spec/support/sinatra_app.rb +2 -0
- data/spec/support/vcr_localhost_server.rb +4 -3
- data/spec/vcr/cassette/reader_spec.rb +4 -4
- data/spec/vcr/cassette_spec.rb +28 -28
- data/spec/vcr/config_spec.rb +11 -11
- data/spec/vcr/deprecations/cassette_spec.rb +4 -4
- data/spec/vcr/deprecations/config_spec.rb +2 -2
- data/spec/vcr/deprecations/http_stubbing_adapters/fakeweb_spec.rb +1 -1
- data/spec/vcr/extensions/net_http_response_spec.rb +3 -3
- data/spec/vcr/extensions/net_http_spec.rb +4 -4
- data/spec/vcr/http_stubbing_adapters/excon_spec.rb +5 -5
- data/spec/vcr/http_stubbing_adapters/faraday_spec.rb +4 -4
- data/spec/vcr/http_stubbing_adapters/multi_object_proxy_spec.rb +4 -4
- data/spec/vcr/middleware/cassette_arguments_spec.rb +5 -5
- data/spec/vcr/middleware/faraday_spec.rb +3 -3
- data/spec/vcr/middleware/rack_spec.rb +4 -4
- data/spec/vcr/request_matcher_spec.rb +13 -13
- data/spec/vcr/structs/http_interaction_spec.rb +6 -6
- data/spec/vcr/structs/request_spec.rb +7 -7
- data/spec/vcr/structs/response_spec.rb +5 -5
- data/spec/vcr/structs/response_status_spec.rb +2 -2
- data/spec/vcr/test_frameworks/cucumber_spec.rb +2 -2
- data/spec/vcr/test_frameworks/rspec_spec.rb +6 -7
- data/spec/vcr/util/hooks_spec.rb +9 -9
- data/spec/vcr_spec.rb +11 -17
- data/vcr.gemspec +11 -5
- metadata +47 -49
- data/features/support/aruba_workaround/aruba_patches.rb +0 -36
- data/features/support/aruba_workaround/background_process.rb +0 -4
@@ -41,7 +41,7 @@ Feature: ignore_localhost
|
|
41
41
|
|
42
42
|
response_body_for(:get, "http://localhost:7777/")
|
43
43
|
"""
|
44
|
-
When I run
|
44
|
+
When I run `ruby localhost_not_ignored.rb`
|
45
45
|
Then it should fail with "<error>"
|
46
46
|
And the file "cassettes/localhost.yml" should contain "body: Response 1"
|
47
47
|
|
@@ -85,7 +85,7 @@ Feature: ignore_localhost
|
|
85
85
|
|
86
86
|
puts response_body_for(:get, "http://localhost:7777/")
|
87
87
|
"""
|
88
|
-
When I run
|
88
|
+
When I run `ruby ignore_localhost_true.rb`
|
89
89
|
Then it should pass with:
|
90
90
|
"""
|
91
91
|
Response 1
|
@@ -64,13 +64,13 @@ Feature: stub_with
|
|
64
64
|
puts "The response for request 2 was: #{response_body_for(:get, "http://localhost:7777/")}"
|
65
65
|
end
|
66
66
|
"""
|
67
|
-
When I run
|
67
|
+
When I run `ruby stubbing_http_lib_combo.rb 'Hello World'`
|
68
68
|
Then the output should contain each of the following:
|
69
69
|
| The response for request 1 was: Hello World |
|
70
70
|
| The response for request 2 was: Hello World |
|
71
71
|
And the file "vcr_cassettes/example.yml" should contain "body: Hello World"
|
72
72
|
|
73
|
-
When I run
|
73
|
+
When I run `ruby stubbing_http_lib_combo.rb 'Goodbye World'`
|
74
74
|
Then the output should contain each of the following:
|
75
75
|
| The response for request 1 was: Goodbye World |
|
76
76
|
| The response for request 2 was: Hello World |
|
@@ -141,7 +141,7 @@ Feature: stub_with
|
|
141
141
|
|
142
142
|
puts "Faraday: #{faraday_response}"
|
143
143
|
"""
|
144
|
-
When I run
|
144
|
+
When I run `ruby stub_with_multiple.rb 'Hello'`
|
145
145
|
Then the output should contain each of the following:
|
146
146
|
| Net::HTTP 1: Hello net_http |
|
147
147
|
| Typhoeus 1: Hello typhoeus |
|
@@ -156,7 +156,7 @@ Feature: stub_with
|
|
156
156
|
| Hello excon |
|
157
157
|
| Hello faraday |
|
158
158
|
|
159
|
-
When I run
|
159
|
+
When I run `ruby stub_with_multiple.rb 'Goodbye'`
|
160
160
|
Then the output should contain each of the following:
|
161
161
|
| Net::HTTP 1: Goodbye net_http |
|
162
162
|
| Typhoeus 1: Goodbye typhoeus |
|
@@ -51,7 +51,7 @@ Feature: EM HTTP Request
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
"""
|
54
|
-
When I run
|
54
|
+
When I run `ruby make_requests.rb Hello`
|
55
55
|
Then the output should contain:
|
56
56
|
"""
|
57
57
|
Hello foo
|
@@ -114,7 +114,7 @@ Feature: EM HTTP Request
|
|
114
114
|
http_version: "1.1"
|
115
115
|
"""
|
116
116
|
|
117
|
-
When I run
|
117
|
+
When I run `ruby make_requests.rb Goodbye`
|
118
118
|
Then the output should contain:
|
119
119
|
"""
|
120
120
|
Hello foo
|
@@ -144,7 +144,7 @@ Feature: EM HTTP Request
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
"""
|
147
|
-
When I run
|
147
|
+
When I run `ruby make_requests.rb Hello`
|
148
148
|
Then the output should contain:
|
149
149
|
"""
|
150
150
|
Hello foo
|
@@ -207,7 +207,7 @@ Feature: EM HTTP Request
|
|
207
207
|
http_version: "1.1"
|
208
208
|
"""
|
209
209
|
|
210
|
-
When I run
|
210
|
+
When I run `ruby make_requests.rb Goodbye`
|
211
211
|
Then the output should contain:
|
212
212
|
"""
|
213
213
|
Hello foo
|
@@ -33,11 +33,11 @@ Feature: Net::HTTP
|
|
33
33
|
puts Net::HTTP.new('localhost', 7777).post('/', '').body
|
34
34
|
end
|
35
35
|
"""
|
36
|
-
When I run
|
36
|
+
When I run `ruby vcr_net_http.rb --with-server`
|
37
37
|
Then the output should contain "VCR works with Net::HTTP posts!"
|
38
38
|
And the file "cassettes/net_http.yml" should contain "body: VCR works with Net::HTTP posts!"
|
39
39
|
|
40
|
-
When I run
|
40
|
+
When I run `ruby vcr_net_http.rb`
|
41
41
|
Then the output should contain "VCR works with Net::HTTP posts!"
|
42
42
|
|
43
43
|
Examples:
|
@@ -65,11 +65,11 @@ Feature: Net::HTTP
|
|
65
65
|
puts perform_request.body
|
66
66
|
end
|
67
67
|
"""
|
68
|
-
When I run
|
68
|
+
When I run `ruby vcr_net_http.rb --with-server`
|
69
69
|
Then the output should contain "VCR works with Net::HTTP gets!"
|
70
70
|
And the file "cassettes/net_http.yml" should contain "body: VCR works with Net::HTTP gets!"
|
71
71
|
|
72
|
-
When I run
|
72
|
+
When I run `ruby vcr_net_http.rb`
|
73
73
|
Then the output should contain "VCR works with Net::HTTP gets!"
|
74
74
|
|
75
75
|
Examples:
|
@@ -97,11 +97,11 @@ Feature: Net::HTTP
|
|
97
97
|
puts body
|
98
98
|
end
|
99
99
|
"""
|
100
|
-
When I run
|
100
|
+
When I run `ruby vcr_net_http.rb --with-server`
|
101
101
|
Then the output should contain "VCR works with Net::HTTP gets!"
|
102
102
|
And the file "cassettes/net_http.yml" should contain "body: VCR works with Net::HTTP gets!"
|
103
103
|
|
104
|
-
When I run
|
104
|
+
When I run `ruby vcr_net_http.rb`
|
105
105
|
Then the output should contain "VCR works with Net::HTTP gets!"
|
106
106
|
|
107
107
|
Examples:
|
@@ -124,11 +124,11 @@ Feature: Net::HTTP
|
|
124
124
|
puts open('http://localhost:7777/').read
|
125
125
|
end
|
126
126
|
"""
|
127
|
-
When I run
|
127
|
+
When I run `ruby vcr_net_http.rb --with-server`
|
128
128
|
Then the output should contain "VCR works with Net::HTTP gets!"
|
129
129
|
And the file "cassettes/net_http.yml" should contain "body: VCR works with Net::HTTP gets!"
|
130
130
|
|
131
|
-
When I run
|
131
|
+
When I run `ruby vcr_net_http.rb`
|
132
132
|
Then the output should contain "VCR works with Net::HTTP gets!"
|
133
133
|
|
134
134
|
Examples:
|
@@ -157,12 +157,12 @@ Feature: Net::HTTP
|
|
157
157
|
puts response.body
|
158
158
|
end
|
159
159
|
"""
|
160
|
-
When I run
|
160
|
+
When I run `ruby vcr_https.rb`
|
161
161
|
Then the output should contain "VCR gist"
|
162
162
|
And the file "cassettes/https.yml" should contain "body: VCR gist"
|
163
163
|
|
164
164
|
When I modify the file "cassettes/https.yml" to replace "body: VCR gist" with "body: HTTPS replaying works"
|
165
|
-
And I run
|
165
|
+
And I run `ruby vcr_https.rb`
|
166
166
|
Then the output should contain "HTTPS replaying works"
|
167
167
|
|
168
168
|
Examples:
|
@@ -45,7 +45,7 @@ Feature: Faraday middleware
|
|
45
45
|
puts "Response 1: #{conn.get('/foo').body}"
|
46
46
|
puts "Response 2: #{conn.get('/foo').body}"
|
47
47
|
"""
|
48
|
-
When I run
|
48
|
+
When I run `ruby faraday_example.rb`
|
49
49
|
Then the output should contain:
|
50
50
|
"""
|
51
51
|
Response 1: Hello foo 1
|
@@ -77,7 +77,7 @@ Feature: Faraday middleware
|
|
77
77
|
puts "Response 3: #{conn.get('/bar').body}"
|
78
78
|
puts "Response 4: #{conn.get('/bar').body}"
|
79
79
|
"""
|
80
|
-
When I run
|
80
|
+
When I run `ruby faraday_example.rb`
|
81
81
|
Then the output should contain:
|
82
82
|
"""
|
83
83
|
Response 1: Hello foo 1
|
@@ -57,7 +57,7 @@ Feature: Rack
|
|
57
57
|
c.allow_http_connections_when_no_cassette = true
|
58
58
|
end
|
59
59
|
"""
|
60
|
-
When I run
|
60
|
+
When I run `ruby client.rb`
|
61
61
|
Then the output should contain:
|
62
62
|
"""
|
63
63
|
Response 1: Hello foo 1
|
@@ -85,7 +85,7 @@ Feature: Rack
|
|
85
85
|
c.allow_http_connections_when_no_cassette = true
|
86
86
|
end
|
87
87
|
"""
|
88
|
-
When I run
|
88
|
+
When I run `ruby client.rb`
|
89
89
|
Then the output should contain:
|
90
90
|
"""
|
91
91
|
Response 1: Hello foo 1
|
@@ -58,7 +58,7 @@ Feature: :all
|
|
58
58
|
puts "Response: #{response.body}"
|
59
59
|
end
|
60
60
|
"""
|
61
|
-
When I run
|
61
|
+
When I run `ruby re_record.rb`
|
62
62
|
Then it should pass with "Response: Hello"
|
63
63
|
And the file "cassettes/example.yml" should contain "body: Hello"
|
64
64
|
But the file "cassettes/example.yml" should not contain "body: old response"
|
@@ -73,7 +73,7 @@ Feature: :all
|
|
73
73
|
puts "Response: #{response.body}"
|
74
74
|
end
|
75
75
|
"""
|
76
|
-
When I run
|
76
|
+
When I run `ruby record_new.rb`
|
77
77
|
Then it should pass with "Response: Goodbye"
|
78
78
|
And the file "cassettes/example.yml" should contain each of these:
|
79
79
|
| body: old response |
|
@@ -57,7 +57,7 @@ Feature: :new_episodes
|
|
57
57
|
puts "Response: #{response.body}"
|
58
58
|
end
|
59
59
|
"""
|
60
|
-
When I run
|
60
|
+
When I run `ruby replay_recorded_response.rb`
|
61
61
|
Then it should pass with "Response: example.com response"
|
62
62
|
|
63
63
|
Scenario: New requests get recorded
|
@@ -70,7 +70,7 @@ Feature: :new_episodes
|
|
70
70
|
puts "Response: #{response.body}"
|
71
71
|
end
|
72
72
|
"""
|
73
|
-
When I run
|
73
|
+
When I run `ruby record_new_requests.rb`
|
74
74
|
Then it should pass with "Response: Hello"
|
75
75
|
And the file "cassettes/example.yml" should contain each of these:
|
76
76
|
| body: example.com response |
|
@@ -51,7 +51,7 @@ Feature: :none
|
|
51
51
|
puts "Response: #{response.body}"
|
52
52
|
end
|
53
53
|
"""
|
54
|
-
When I run
|
54
|
+
When I run `ruby replay_recorded_response.rb`
|
55
55
|
Then it should pass with "Response: Hello"
|
56
56
|
|
57
57
|
Scenario: New requests are prevented
|
@@ -63,5 +63,5 @@ Feature: :none
|
|
63
63
|
Net::HTTP.get_response('example.com', '/bar')
|
64
64
|
end
|
65
65
|
"""
|
66
|
-
When I run
|
66
|
+
When I run `ruby prevent_new_request.rb`
|
67
67
|
Then it should fail with "Real HTTP connections are disabled. Unregistered request: GET http://example.com/bar"
|
@@ -60,7 +60,7 @@ Feature: :once
|
|
60
60
|
puts "Response: #{response.body}"
|
61
61
|
end
|
62
62
|
"""
|
63
|
-
When I run
|
63
|
+
When I run `ruby replay_recorded_response.rb`
|
64
64
|
Then it should pass with "Response: example.com response"
|
65
65
|
|
66
66
|
Scenario: New requests result in an error when the cassette file exists
|
@@ -73,7 +73,7 @@ Feature: :once
|
|
73
73
|
puts "Response: #{response.body}"
|
74
74
|
end
|
75
75
|
"""
|
76
|
-
When I run
|
76
|
+
When I run `ruby error_for_new_requests_when_cassette_exists.rb`
|
77
77
|
Then it should fail with "Real HTTP connections are disabled"
|
78
78
|
|
79
79
|
Scenario: New requests get recorded when there is no cassette file
|
@@ -87,6 +87,6 @@ Feature: :once
|
|
87
87
|
end
|
88
88
|
"""
|
89
89
|
When I remove the file "cassettes/example.yml"
|
90
|
-
And I run
|
90
|
+
And I run `ruby record_new_requests.rb`
|
91
91
|
Then it should pass with "Response: Hello"
|
92
92
|
And the file "cassettes/example.yml" should contain "body: Hello"
|
@@ -69,7 +69,7 @@ Given /^the directory "([^"]*)" does not exist$/ do |dir|
|
|
69
69
|
end
|
70
70
|
|
71
71
|
Given /^a previously recorded cassette file "([^"]*)" with:$/ do |file_name, content|
|
72
|
-
|
72
|
+
write_file(file_name, normalize_cassette_yaml(content))
|
73
73
|
end
|
74
74
|
|
75
75
|
Given /^(\d+) days have passed since the cassette was recorded$/ do |day_count|
|
@@ -80,6 +80,10 @@ When /^I modify the file "([^"]*)" to replace "([^"]*)" with "([^"]*)"$/ do |fil
|
|
80
80
|
modify_file(file_name, orig_text, new_text)
|
81
81
|
end
|
82
82
|
|
83
|
+
When /^I set the "([^"]*)" environment variable to "([^"]*)"$/ do |var, value|
|
84
|
+
set_env(var, value)
|
85
|
+
end
|
86
|
+
|
83
87
|
Then /^the file "([^"]*)" should exist$/ do |file_name|
|
84
88
|
check_file_presence([file_name], true)
|
85
89
|
end
|
@@ -90,7 +94,7 @@ end
|
|
90
94
|
|
91
95
|
Then /^the output should contain each of the following:$/ do |table|
|
92
96
|
table.raw.flatten.each do |string|
|
93
|
-
assert_partial_output(string)
|
97
|
+
assert_partial_output(string, all_output)
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
data/features/support/env.rb
CHANGED
@@ -2,14 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'bundler'
|
3
3
|
Bundler.setup
|
4
4
|
|
5
|
-
|
6
|
-
# dependency on background_process. We have a work around to fix this.
|
7
|
-
NEEDS_ARUBA_FIX = defined?(RUBY_ENGINE) && %w[ jruby rbx ].include?(RUBY_ENGINE)
|
8
|
-
|
9
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/aruba_workaround' if NEEDS_ARUBA_FIX
|
10
|
-
|
11
|
-
require 'aruba'
|
12
|
-
require 'aruba_patches' if NEEDS_ARUBA_FIX
|
5
|
+
require 'aruba/cucumber'
|
13
6
|
|
14
7
|
Before do
|
15
8
|
this_dir = File.dirname(__FILE__)
|
@@ -28,3 +21,7 @@ elsif RUBY_PLATFORM == 'java'
|
|
28
21
|
end
|
29
22
|
end
|
30
23
|
|
24
|
+
Before do
|
25
|
+
@aruba_timeout_seconds = RUBY_PLATFORM == 'java' ? 60 : 10
|
26
|
+
end
|
27
|
+
|
@@ -21,7 +21,12 @@ elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
|
|
21
21
|
UNSUPPORTED_HTTP_LIBS = %w[ patron em-http-request curb ]
|
22
22
|
elsif RUBY_PLATFORM == 'java'
|
23
23
|
# These gems have C extensions and can't install on JRuby.
|
24
|
-
|
24
|
+
c_dependent_libs = %w[ typhoeus patron curb em-http-request ]
|
25
|
+
|
26
|
+
# The latest version of httpclient seems to freeze up the cukes
|
27
|
+
# on JRuby. I'm not sure why, and there's little benefit to running
|
28
|
+
# them on JRuby...so we just skip them. Excon seems to have the same issue :(.
|
29
|
+
UNSUPPORTED_HTTP_LIBS = c_dependent_libs + %w[ httpclient excon ]
|
25
30
|
elsif RUBY_VERSION == '1.8.6' && ENV['TRAVIS']
|
26
31
|
UNSUPPORTED_HTTP_LIBS = %w[ em-http-request ]
|
27
32
|
end
|
@@ -89,7 +89,7 @@ Feature: Usage with Cucumber
|
|
89
89
|
When a request is made to "http://localhost:7777/disallowed_2"
|
90
90
|
"""
|
91
91
|
And the directory "features/cassettes" does not exist
|
92
|
-
When I run
|
92
|
+
When I run `cucumber WITH_SERVER=true features/vcr_example.feature`
|
93
93
|
Then it should fail with "3 scenarios (2 failed, 1 passed)"
|
94
94
|
And the output should contain each of the following:
|
95
95
|
| Real HTTP connections are disabled. Unregistered request: GET http://localhost:7777/disallowed_1 |
|
@@ -101,7 +101,7 @@ Feature: Usage with Cucumber
|
|
101
101
|
|
102
102
|
# Run again without the server; we'll get the same responses because VCR
|
103
103
|
# will replay the recorded responses.
|
104
|
-
When I run
|
104
|
+
When I run `cucumber features/vcr_example.feature`
|
105
105
|
Then it should fail with "3 scenarios (2 failed, 1 passed)"
|
106
106
|
And the output should contain each of the following:
|
107
107
|
| Real HTTP connections are disabled. Unregistered request: GET http://localhost:7777/disallowed_1 |
|
@@ -77,7 +77,7 @@ Feature: Usage with RSpec
|
|
77
77
|
c.extend VCR::RSpec::Macros
|
78
78
|
end
|
79
79
|
"""
|
80
|
-
When I run
|
80
|
+
When I run `rspec spec/vcr_example_spec.rb`
|
81
81
|
Then the output should contain "2 examples, 0 failures"
|
82
82
|
And the file "spec/cassettes/VCR-RSpec_integration/without_an_explicit_cassette_name.yml" should contain "body: Hello"
|
83
83
|
And the file "spec/cassettes/net_http_example.yml" should contain "body: Hello"
|
@@ -103,7 +103,7 @@ Feature: Usage with RSpec
|
|
103
103
|
c.extend VCR::RSpec::Macros
|
104
104
|
end
|
105
105
|
"""
|
106
|
-
When I run
|
106
|
+
When I run `ruby -Ispec spec/vcr_example_spec.rb`
|
107
107
|
Then the output should contain "2 examples, 0 failures"
|
108
108
|
And the file "spec/cassettes/VCR-RSpec_integration/without_an_explicit_cassette_name.yml" should contain "body: Hello"
|
109
109
|
And the file "spec/cassettes/net_http_example.yml" should contain "body: Hello"
|
@@ -13,18 +13,19 @@ Feature: Usage with Shoulda
|
|
13
13
|
errors occur.
|
14
14
|
|
15
15
|
Scenario: Use `VCR.insert_cassette` and `VCR.eject_cassette`
|
16
|
-
Given a file named "test/
|
16
|
+
Given a file named "test/test_server.rb" with:
|
17
17
|
"""
|
18
|
-
require 'test/unit'
|
19
|
-
require 'shoulda'
|
20
18
|
require 'vcr_cucumber_helpers'
|
21
19
|
|
22
|
-
|
23
|
-
|
24
|
-
get('/') { "Hello" }
|
25
|
-
end
|
20
|
+
start_sinatra_app(:port => 7777) do
|
21
|
+
get('/') { "Hello" }
|
26
22
|
end
|
27
|
-
|
23
|
+
"""
|
24
|
+
Given a file named "test/test_helper.rb" with:
|
25
|
+
"""
|
26
|
+
require 'test/test_server' if ENV['SERVER'] == 'true'
|
27
|
+
require 'test/unit'
|
28
|
+
require 'shoulda'
|
28
29
|
require 'vcr'
|
29
30
|
|
30
31
|
VCR.config do |c|
|
@@ -55,10 +56,12 @@ Feature: Usage with Shoulda
|
|
55
56
|
end
|
56
57
|
"""
|
57
58
|
And the directory "test/fixtures/vcr_cassettes" does not exist
|
58
|
-
When I
|
59
|
+
When I set the "SERVER" environment variable to "true"
|
60
|
+
And I run `ruby -Itest test/vcr_example_test.rb`
|
59
61
|
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
60
62
|
And the file "test/fixtures/vcr_cassettes/shoulda_example.yml" should contain "body: Hello"
|
61
63
|
|
62
64
|
# Run again without starting the sinatra server so the response will be replayed
|
63
|
-
When I
|
65
|
+
When I set the "SERVER" environment variable to "false"
|
66
|
+
And I run `ruby -Itest test/vcr_example_test.rb`
|
64
67
|
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
@@ -4,17 +4,18 @@ Feature: Usage with Test::Unit
|
|
4
4
|
`VCR.use_cassette`.
|
5
5
|
|
6
6
|
Scenario: Use `VCR.use_cassette` in a test
|
7
|
-
Given a file named "test/
|
7
|
+
Given a file named "test/test_server.rb" with:
|
8
8
|
"""
|
9
|
-
require 'test/unit'
|
10
9
|
require 'vcr_cucumber_helpers'
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
get('/') { "Hello" }
|
15
|
-
end
|
11
|
+
start_sinatra_app(:port => 7777) do
|
12
|
+
get('/') { "Hello" }
|
16
13
|
end
|
17
|
-
|
14
|
+
"""
|
15
|
+
Given a file named "test/test_helper.rb" with:
|
16
|
+
"""
|
17
|
+
require 'test/test_server' if ENV['SERVER'] == 'true'
|
18
|
+
require 'test/unit'
|
18
19
|
require 'vcr'
|
19
20
|
|
20
21
|
VCR.config do |c|
|
@@ -37,10 +38,12 @@ Feature: Usage with Test::Unit
|
|
37
38
|
end
|
38
39
|
"""
|
39
40
|
And the directory "test/fixtures/vcr_cassettes" does not exist
|
40
|
-
When I
|
41
|
+
When I set the "SERVER" environment variable to "true"
|
42
|
+
And I run `ruby -Itest test/vcr_example_test.rb`
|
41
43
|
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
42
44
|
And the file "test/fixtures/vcr_cassettes/test_unit_example.yml" should contain "body: Hello"
|
43
45
|
|
44
46
|
# Run again without starting the sinatra server so the response will be replayed
|
45
|
-
When I
|
47
|
+
When I set the "SERVER" environment variable to "false"
|
48
|
+
And I run `ruby -Itest test/vcr_example_test.rb`
|
46
49
|
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|