vcr 1.11.1 → 1.11.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -31,8 +31,8 @@ describe VCR::HttpStubbingAdapters::Excon do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
recorded.should
|
35
|
-
recorded.should
|
34
|
+
recorded.should eq(played_back)
|
35
|
+
recorded.should eq('query: Tolkien')
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -51,8 +51,8 @@ describe VCR::HttpStubbingAdapters::Excon do
|
|
51
51
|
chunks.join
|
52
52
|
end
|
53
53
|
|
54
|
-
recorded.should
|
55
|
-
recorded.should
|
54
|
+
recorded.should eq(played_back)
|
55
|
+
recorded.should eq("FOO!")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -61,7 +61,7 @@ describe VCR::HttpStubbingAdapters::Excon do
|
|
61
61
|
described_class.http_connections_allowed = true
|
62
62
|
|
63
63
|
VCR.should_receive(:record_http_interaction) do |interaction|
|
64
|
-
interaction.response.status.code.should
|
64
|
+
interaction.response.status.code.should eq(404)
|
65
65
|
end
|
66
66
|
|
67
67
|
expect {
|
@@ -40,10 +40,10 @@ describe VCR::HttpStubbingAdapters::Faraday do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_stubbed_responses
|
43
|
-
stubbed_response_for(request_1).should
|
44
|
-
stubbed_response_for(request_1).should
|
45
|
-
stubbed_response_for(request_1).should
|
46
|
-
stubbed_response_for(request_1).should
|
43
|
+
stubbed_response_for(request_1).should eq(:response_1)
|
44
|
+
stubbed_response_for(request_1).should eq(:response_2)
|
45
|
+
stubbed_response_for(request_1).should eq(:response_2)
|
46
|
+
stubbed_response_for(request_1).should eq(:response_2)
|
47
47
|
end
|
48
48
|
|
49
49
|
describe '.stubbed_response_for' do
|
@@ -17,12 +17,12 @@ module VCR
|
|
17
17
|
|
18
18
|
it 'is a basic object with very few of its own methods' do
|
19
19
|
inst_methods = described_class.instance_methods.map { |m| m.to_sym }
|
20
|
-
inst_methods.should_not include(:send, :object_id
|
20
|
+
inst_methods.should_not include(:send, :object_id)
|
21
21
|
end
|
22
22
|
|
23
23
|
describe '#proxied_objects' do
|
24
24
|
it 'returns the proxied objects' do
|
25
|
-
subject.proxied_objects.should
|
25
|
+
subject.proxied_objects.should eq([mock1, mock2])
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -51,7 +51,7 @@ module VCR
|
|
51
51
|
mock1.should_not respond_to(:request_stubbed?)
|
52
52
|
mock2.should_receive(:request_stubbed?).and_return(true)
|
53
53
|
|
54
|
-
subject.request_stubbed?.should
|
54
|
+
subject.request_stubbed?.should eq(true)
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'proxies messages to each object' do
|
@@ -74,7 +74,7 @@ module VCR
|
|
74
74
|
mock1.should_receive(method).and_return(:return_value_1)
|
75
75
|
mock2.should_receive(method).and_return(:return_value_1)
|
76
76
|
|
77
|
-
subject.__send__(method).should
|
77
|
+
subject.__send__(method).should eq(:return_value_1)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -8,24 +8,24 @@ describe VCR::Middleware::CassetteArguments do
|
|
8
8
|
|
9
9
|
it 'stores the given value, returning it when no arg is given' do
|
10
10
|
subject.name :value1
|
11
|
-
subject.name.should
|
11
|
+
subject.name.should eq(:value1)
|
12
12
|
|
13
13
|
subject.name :value2
|
14
|
-
subject.name.should
|
14
|
+
subject.name.should eq(:value2)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe '#options' do
|
19
19
|
it 'initially returns an empty hash' do
|
20
|
-
subject.options.should
|
20
|
+
subject.options.should eq({})
|
21
21
|
end
|
22
22
|
|
23
23
|
it 'merges the given hash options, returning them when no arg is given' do
|
24
24
|
subject.options :record => :new_episodes
|
25
|
-
subject.options.should
|
25
|
+
subject.options.should eq({ :record => :new_episodes })
|
26
26
|
|
27
27
|
subject.options :erb => true
|
28
|
-
subject.options.should
|
28
|
+
subject.options.should eq({ :record => :new_episodes, :erb => true })
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -25,13 +25,13 @@ describe VCR::Middleware::Faraday do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'sets the cassette name based on the provided block' do
|
28
|
-
app = lambda { |env| VCR.current_cassette.name.should
|
28
|
+
app = lambda { |env| VCR.current_cassette.name.should eq('rack_cassette') }
|
29
29
|
instance = described_class.new(app) { |c| c.name 'rack_cassette' }
|
30
30
|
instance.call(env_hash)
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'sets the cassette options based on the provided block' do
|
34
|
-
app = lambda { |env| VCR.current_cassette.erb.should
|
34
|
+
app = lambda { |env| VCR.current_cassette.erb.should eq({ :foo => :bar }) }
|
35
35
|
instance = described_class.new(app, &lambda do |c|
|
36
36
|
c.name 'c'
|
37
37
|
c.options :erb => { :foo => :bar }
|
@@ -42,7 +42,7 @@ describe VCR::Middleware::Faraday do
|
|
42
42
|
|
43
43
|
it 'yields the env to the provided block when the block accepts 2 arguments' do
|
44
44
|
instance = described_class.new(lambda { |env| }, &lambda do |c, env|
|
45
|
-
env.should
|
45
|
+
env.should eq(env_hash)
|
46
46
|
c.name 'c'
|
47
47
|
end)
|
48
48
|
|
@@ -15,7 +15,7 @@ describe VCR::Middleware::Rack do
|
|
15
15
|
rack_app = mock
|
16
16
|
rack_app.should_receive(:call).with(env_hash).and_return(:response)
|
17
17
|
instance = described_class.new(rack_app) { |c| c.name 'cassette_name' }
|
18
|
-
instance.call(env_hash).should
|
18
|
+
instance.call(env_hash).should eq(:response)
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'uses a cassette when the rack app is called' do
|
@@ -27,13 +27,13 @@ describe VCR::Middleware::Rack do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'sets the cassette name based on the provided block' do
|
30
|
-
rack_app = lambda { |env| VCR.current_cassette.name.should
|
30
|
+
rack_app = lambda { |env| VCR.current_cassette.name.should eq('rack_cassette') }
|
31
31
|
instance = described_class.new(rack_app) { |c| c.name 'rack_cassette' }
|
32
32
|
instance.call({})
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'sets the cassette options based on the provided block' do
|
36
|
-
rack_app = lambda { |env| VCR.current_cassette.erb.should
|
36
|
+
rack_app = lambda { |env| VCR.current_cassette.erb.should eq({ :foo => :bar }) }
|
37
37
|
instance = described_class.new(rack_app, &lambda do |c|
|
38
38
|
c.name 'c'
|
39
39
|
c.options :erb => { :foo => :bar }
|
@@ -44,7 +44,7 @@ describe VCR::Middleware::Rack do
|
|
44
44
|
|
45
45
|
it 'yields the rack env to the provided block when the block accepts 2 arguments' do
|
46
46
|
instance = described_class.new(lambda { |env| }, &lambda do |c, env|
|
47
|
-
env.should
|
47
|
+
env.should eq(env_hash)
|
48
48
|
c.name 'c'
|
49
49
|
end)
|
50
50
|
|
@@ -10,7 +10,7 @@ describe VCR::RequestMatcher do
|
|
10
10
|
describe '#uri' do
|
11
11
|
def self.for_matcher(*attributes, &block)
|
12
12
|
context "for match_attributes = #{attributes.inspect}" do
|
13
|
-
subject {
|
13
|
+
subject { VCR::RequestMatcher.new(stub(:uri => uri), attributes).uri }
|
14
14
|
module_eval(&block)
|
15
15
|
end
|
16
16
|
end
|
@@ -18,11 +18,11 @@ describe VCR::RequestMatcher do
|
|
18
18
|
let(:uri) { 'http://foo.example.com/path/to/something?param=value' }
|
19
19
|
|
20
20
|
for_matcher do
|
21
|
-
it("returns a regex that matches any URI") { should
|
21
|
+
it("returns a regex that matches any URI") { should eq(/.*/) }
|
22
22
|
end
|
23
23
|
|
24
24
|
for_matcher :uri do
|
25
|
-
it("returns the exact uri") { should
|
25
|
+
it("returns the exact uri") { should eq(uri) }
|
26
26
|
end
|
27
27
|
|
28
28
|
for_matcher :host do
|
@@ -73,7 +73,7 @@ describe VCR::RequestMatcher do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
[[:uri, :host], [:uri, :path], [:uri, :host, :path]].each do |attributes|
|
76
|
-
for_matcher
|
76
|
+
for_matcher(*attributes) do
|
77
77
|
it "raises an appropriate error" do
|
78
78
|
expect { subject }.to raise_error(/match_attributes cannot include/)
|
79
79
|
end
|
@@ -83,7 +83,7 @@ describe VCR::RequestMatcher do
|
|
83
83
|
it "returns the request's URI when it is a regex, regardless of the match attributes" do
|
84
84
|
[:uri, :host, :path].each do |attribute|
|
85
85
|
matcher = VCR::RequestMatcher.new(stub(:uri => /some regex/), [attribute])
|
86
|
-
matcher.uri.should
|
86
|
+
matcher.uri.should eq(/some regex/)
|
87
87
|
end
|
88
88
|
end
|
89
89
|
end
|
@@ -91,7 +91,7 @@ describe VCR::RequestMatcher do
|
|
91
91
|
describe '#method' do
|
92
92
|
it 'returns the request method when the match attributes include :method' do
|
93
93
|
matcher = VCR::RequestMatcher.new(stub(:method => :get), [:method])
|
94
|
-
matcher.method.should
|
94
|
+
matcher.method.should eq(:get)
|
95
95
|
end
|
96
96
|
|
97
97
|
it 'returns nil when the match attributes do not include :method' do
|
@@ -103,7 +103,7 @@ describe VCR::RequestMatcher do
|
|
103
103
|
describe '#body' do
|
104
104
|
it 'returns the request body when the match attributes include :body' do
|
105
105
|
matcher = VCR::RequestMatcher.new(stub(:body => 'id=7'), [:body])
|
106
|
-
matcher.body.should
|
106
|
+
matcher.body.should eq('id=7')
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'returns nil when the match attributes do not include :body' do
|
@@ -115,7 +115,7 @@ describe VCR::RequestMatcher do
|
|
115
115
|
describe '#headers' do
|
116
116
|
it 'returns the request headers when the match attributes include :headers' do
|
117
117
|
matcher = VCR::RequestMatcher.new(stub(:headers => { 'key' => 'value' }), [:headers])
|
118
|
-
matcher.headers.should
|
118
|
+
matcher.headers.should eq({ 'key' => 'value' })
|
119
119
|
end
|
120
120
|
|
121
121
|
it 'returns nil when the match attributes do not include :headers' do
|
@@ -152,14 +152,14 @@ describe VCR::RequestMatcher do
|
|
152
152
|
describe '#hash' do
|
153
153
|
it 'returns the same code for two objects when #match_attributes, #method, #uri, #body and #headers are the same, even when the request object is different' do
|
154
154
|
m1, m2 = matchers_varying_on(:request)
|
155
|
-
m1.hash.should
|
155
|
+
m1.hash.should eq(m2.hash)
|
156
156
|
end
|
157
157
|
|
158
158
|
it 'returns the same code for two objects when the matchers are the same, but #match_attributes has its elements in a different order' do
|
159
159
|
m1, m2 = matcher, matcher
|
160
160
|
m1.match_attributes = [:method, :uri, :body, :headers]
|
161
161
|
m2.match_attributes = [:method, :body, :uri, :headers]
|
162
|
-
m1.hash.should
|
162
|
+
m1.hash.should eq(m2.hash)
|
163
163
|
end
|
164
164
|
|
165
165
|
[:match_attributes, :method, :uri, :body, :headers].each do |different_attr|
|
@@ -173,19 +173,19 @@ describe VCR::RequestMatcher do
|
|
173
173
|
it 'returns the same code for the same headers' do
|
174
174
|
m1 = matcher_with_headers('x-http-header' => ['val1'])
|
175
175
|
m2 = matcher_with_headers('x-http-header' => ['val1'])
|
176
|
-
m1.hash.should
|
176
|
+
m1.hash.should eq(m2.hash)
|
177
177
|
end
|
178
178
|
|
179
179
|
it 'returns the same code when the header keys are ordered differently' do
|
180
180
|
m1 = matcher_with_headers('x-http-header1' => ['val1'], 'x-http-header2' => ['val2'])
|
181
181
|
m2 = matcher_with_headers('x-http-header2' => ['val2'], 'x-http-header1' => ['val1'])
|
182
|
-
m1.hash.should
|
182
|
+
m1.hash.should eq(m2.hash)
|
183
183
|
end
|
184
184
|
|
185
185
|
it 'returns the same code when the header value arrays are ordered differently' do
|
186
186
|
m1 = matcher_with_headers('x-http-header' => ['val1', 'val2'])
|
187
187
|
m2 = matcher_with_headers('x-http-header' => ['val2', 'val1'])
|
188
|
-
m1.hash.should
|
188
|
+
m1.hash.should eq(m2.hash)
|
189
189
|
end
|
190
190
|
|
191
191
|
it 'returns a different code when the header values are different' do
|
@@ -6,7 +6,7 @@ describe VCR::HTTPInteraction do
|
|
6
6
|
sig = mock('request signature')
|
7
7
|
sig.should_receive(attr).and_return(:the_value)
|
8
8
|
instance = described_class.new(sig, nil)
|
9
|
-
instance.send(attr).should
|
9
|
+
instance.send(attr).should eq(:the_value)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -62,23 +62,23 @@ describe VCR::HTTPInteraction do
|
|
62
62
|
|
63
63
|
[:request, :response].each do |part|
|
64
64
|
it "replaces the sensitive text in the #{part} header keys and values" do
|
65
|
-
subject.send(part).headers.should
|
65
|
+
subject.send(part).headers.should eq({
|
66
66
|
'x-http-AAA' => ['bar23', '23AAA'],
|
67
67
|
'x-http-bar' => ['AAA23', '18']
|
68
|
-
}
|
68
|
+
})
|
69
69
|
end
|
70
70
|
|
71
71
|
it "replaces the sensitive text in the #{part} body" do
|
72
|
-
subject.send(part).body.should
|
72
|
+
subject.send(part).body.should eq("The body AAA this is (AAA-Foo)")
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'replaces the sensitive text in the response status' do
|
77
|
-
subject.response.status.message.should
|
77
|
+
subject.response.status.message.should eq('OK AAA')
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'replaces sensitive text in the request URI' do
|
81
|
-
subject.request.uri.should
|
81
|
+
subject.request.uri.should eq('http://example-AAA.com:80/AAA/')
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
@@ -4,7 +4,7 @@ describe VCR::Request do
|
|
4
4
|
describe '#matcher' do
|
5
5
|
it 'returns a matcher with the given request' do
|
6
6
|
req = VCR::Request.new
|
7
|
-
req.matcher([:uri]).request.should
|
7
|
+
req.matcher([:uri]).request.should eq(req)
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'returns a matcher with the given match_attributes' do
|
@@ -18,7 +18,7 @@ describe VCR::Request do
|
|
18
18
|
|
19
19
|
context 'when given no arguments' do
|
20
20
|
it 'returns the HTTP method' do
|
21
|
-
subject.method.should
|
21
|
+
subject.method.should eq(:get)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ describe VCR::Request do
|
|
26
26
|
it 'returns the method object for the named method' do
|
27
27
|
m = subject.method(:class)
|
28
28
|
m.should be_a(Method)
|
29
|
-
m.call.should
|
29
|
+
m.call.should eq(described_class)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -42,13 +42,13 @@ describe VCR::Request do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it { should be_instance_of(VCR::Request) }
|
45
|
-
its(:method) { should
|
46
|
-
its(:body) { should
|
47
|
-
its(:headers) { should
|
45
|
+
its(:method) { should eq(:post) }
|
46
|
+
its(:body) { should eq('id=7') }
|
47
|
+
its(:headers) { should eq({ "content-type" => ["application/x-www-form-urlencoded"] }) }
|
48
48
|
|
49
49
|
it 'sets the uri using the http_stubbing_adapter.request_uri' do
|
50
50
|
VCR.http_stubbing_adapter.should_receive(:request_uri).with(net_http, request).and_return('foo/bar')
|
51
|
-
subject.uri.should
|
51
|
+
subject.uri.should eq('foo/bar')
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -6,9 +6,9 @@ describe VCR::Response do
|
|
6
6
|
subject { described_class.from_net_http_response(response) }
|
7
7
|
|
8
8
|
it { should be_instance_of(described_class) }
|
9
|
-
its(:body) { should
|
10
|
-
its(:http_version) { should
|
11
|
-
its(:headers) { should
|
9
|
+
its(:body) { should eq('The response from example.com') }
|
10
|
+
its(:http_version) { should eq('1.1') }
|
11
|
+
its(:headers) { should eq({
|
12
12
|
"last-modified" => ['Tue, 15 Nov 2005 13:24:10 GMT'],
|
13
13
|
"etag" => ["\"24ec5-1b6-4059a80bfd280\""],
|
14
14
|
"content-type" => ["text/html; charset=UTF-8"],
|
@@ -16,12 +16,12 @@ describe VCR::Response do
|
|
16
16
|
"server" => ['Apache/2.2.3 (CentOS)'],
|
17
17
|
"content-length" => ['438'],
|
18
18
|
"accept-ranges" => ['bytes']
|
19
|
-
} }
|
19
|
+
}) }
|
20
20
|
|
21
21
|
it 'assigns the status using VCR::ResponseStatus.from_net_http_response' do
|
22
22
|
VCR::ResponseStatus.should respond_to(:from_net_http_response)
|
23
23
|
VCR::ResponseStatus.should_receive(:from_net_http_response).with(response).and_return(:the_status)
|
24
|
-
subject.status.should
|
24
|
+
subject.status.should eq(:the_status)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -6,8 +6,8 @@ describe VCR::ResponseStatus do
|
|
6
6
|
subject { described_class.from_net_http_response(response) }
|
7
7
|
|
8
8
|
it { should be_instance_of(described_class) }
|
9
|
-
its(:code) { should
|
10
|
-
its(:message) { should
|
9
|
+
its(:code) { should eq(200) }
|
10
|
+
its(:message) { should eq('OK') }
|
11
11
|
end
|
12
12
|
|
13
13
|
it_performs 'status message normalization' do
|
@@ -18,7 +18,7 @@ describe VCR::CucumberTags do
|
|
18
18
|
VCR.current_cassette.should be_nil
|
19
19
|
|
20
20
|
before_blocks_for_tags[tag].call
|
21
|
-
VCR.current_cassette.send(cassette_attribute).should
|
21
|
+
VCR.current_cassette.send(cassette_attribute).should eq(expected_value)
|
22
22
|
after_blocks_for_tags[tag].call
|
23
23
|
|
24
24
|
VCR.current_cassette.should be_nil
|
@@ -54,7 +54,7 @@ describe VCR::CucumberTags do
|
|
54
54
|
it 'returns the list of cucumber tags' do
|
55
55
|
subject.tags 'tag1', 'tag2'
|
56
56
|
subject.tags 'tag3', 'tag4'
|
57
|
-
described_class.tags[-4, 4].should
|
57
|
+
described_class.tags[-4, 4].should eq(%w(@tag1 @tag2 @tag3 @tag4))
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
@@ -7,20 +7,19 @@ describe VCR::RSpec::Macros do
|
|
7
7
|
def self.perform_test(context_name, expected_cassette_name, *args, &block)
|
8
8
|
context context_name do
|
9
9
|
after(:each) do
|
10
|
-
if
|
10
|
+
if example.metadata[:test_ejection]
|
11
11
|
VCR.current_cassette.should be_nil
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
use_vcr_cassette
|
15
|
+
use_vcr_cassette(*args)
|
16
16
|
|
17
|
-
it 'ejects the cassette in an after hook' do
|
17
|
+
it 'ejects the cassette in an after hook', :test_ejection do
|
18
18
|
VCR.current_cassette.should be_a(VCR::Cassette)
|
19
|
-
@test_ejection = true
|
20
19
|
end
|
21
20
|
|
22
21
|
it "creates a cassette named '#{expected_cassette_name}" do
|
23
|
-
VCR.current_cassette.name.should
|
22
|
+
VCR.current_cassette.name.should eq(expected_cassette_name)
|
24
23
|
end
|
25
24
|
|
26
25
|
module_eval(&block) if block
|
@@ -31,7 +30,7 @@ describe VCR::RSpec::Macros do
|
|
31
30
|
|
32
31
|
perform_test 'when called with an explicit name and some options', 'explicit_name', 'explicit_name', :match_requests_on => [:method, :host] do
|
33
32
|
it 'uses the provided cassette options' do
|
34
|
-
VCR.current_cassette.match_requests_on.should
|
33
|
+
VCR.current_cassette.match_requests_on.should eq([:method, :host])
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
@@ -39,7 +38,7 @@ describe VCR::RSpec::Macros do
|
|
39
38
|
|
40
39
|
perform_test 'when called with some options', 'VCR::RSpec::Macros/#use_vcr_cassette/when called with some options', :match_requests_on => [:method, :host] do
|
41
40
|
it 'uses the provided cassette options' do
|
42
|
-
VCR.current_cassette.match_requests_on.should
|
41
|
+
VCR.current_cassette.match_requests_on.should eq([:method, :host])
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|