vcr 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +12 -0
- data/FullBuildRakeFile +22 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +46 -25
- data/Guardfile +9 -0
- data/README.md +10 -371
- data/Rakefile +6 -2
- data/TODO.md +4 -0
- data/features/support/env.rb +5 -1
- data/full_build +1 -0
- data/lib/vcr.rb +17 -7
- data/lib/vcr/basic_object.rb +39 -0
- data/lib/vcr/config.rb +4 -7
- data/lib/vcr/deprecations.rb +14 -0
- data/lib/vcr/http_stubbing_adapters/common.rb +44 -13
- data/lib/vcr/http_stubbing_adapters/fakeweb.rb +17 -28
- data/lib/vcr/http_stubbing_adapters/multi_object_proxy.rb +43 -0
- data/lib/vcr/http_stubbing_adapters/typhoeus.rb +101 -0
- data/lib/vcr/http_stubbing_adapters/webmock.rb +16 -37
- data/lib/vcr/internet_connection.rb +2 -1
- data/lib/vcr/structs.rb +32 -0
- data/lib/vcr/version.rb +1 -1
- data/spec/config_spec.rb +5 -25
- data/spec/deprecations_spec.rb +31 -3
- data/spec/extensions/net_http_spec.rb +1 -0
- data/spec/fixtures/1.9.1/fake_example.com_responses.yml +32 -1
- data/spec/fixtures/not_1.9.1/fake_example.com_responses.yml +32 -1
- data/spec/http_stubbing_adapters/fakeweb_spec.rb +9 -24
- data/spec/http_stubbing_adapters/multi_object_proxy_spec.rb +101 -0
- data/spec/http_stubbing_adapters/typhoeus_spec.rb +28 -0
- data/spec/http_stubbing_adapters/webmock_spec.rb +8 -26
- data/spec/internet_connection_spec.rb +25 -7
- data/spec/spec_helper.rb +3 -1
- data/spec/structs_spec.rb +30 -6
- data/spec/support/http_library_adapters.rb +50 -15
- data/spec/support/http_stubbing_adapter.rb +65 -56
- data/spec/support/version_checker.rb +29 -0
- data/spec/vcr_spec.rb +30 -12
- data/vcr.gemspec +5 -4
- metadata +44 -15
@@ -0,0 +1,29 @@
|
|
1
|
+
shared_examples_for "version checking" do |options|
|
2
|
+
library = described_class.library_name
|
3
|
+
|
4
|
+
describe '#check_version!' do
|
5
|
+
options[:valid].each do |version|
|
6
|
+
it "does nothing when #{library}'s version is #{version}" do
|
7
|
+
stub_version(version)
|
8
|
+
described_class.should_not_receive(:warn)
|
9
|
+
expect { described_class.check_version! }.to_not raise_error
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
options[:too_low].each do |version|
|
14
|
+
it "raises an error when #{library}'s version is #{version}" do
|
15
|
+
stub_version(version)
|
16
|
+
described_class.should_not_receive(:warn)
|
17
|
+
expect { described_class.check_version! }.to raise_error(/You are using #{library} #{version}. VCR requires version/)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
options[:too_high].each do |version|
|
22
|
+
it "does nothing when #{library}'s version is #{version}" do
|
23
|
+
stub_version(version)
|
24
|
+
described_class.should_receive(:warn).with(/VCR is known to work with #{library}/)
|
25
|
+
expect { described_class.check_version! }.to_not raise_error
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/spec/vcr_spec.rb
CHANGED
@@ -115,22 +115,40 @@ describe VCR do
|
|
115
115
|
VCR.instance_variable_set(:@http_stubbing_adapter, nil)
|
116
116
|
end
|
117
117
|
|
118
|
+
it 'returns a multi object proxy for the configured stubbing libraries when multiple libs are configured', :unless => RUBY_PLATFORM == 'java' do
|
119
|
+
VCR::Config.stub_with :fakeweb, :typhoeus
|
120
|
+
VCR.http_stubbing_adapter.proxied_objects.should == [
|
121
|
+
VCR::HttpStubbingAdapters::FakeWeb,
|
122
|
+
VCR::HttpStubbingAdapters::Typhoeus
|
123
|
+
]
|
124
|
+
end
|
125
|
+
|
118
126
|
{
|
119
|
-
:fakeweb
|
120
|
-
:webmock
|
121
|
-
}.each do |
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
it "returns #{adapter}" do
|
126
|
-
subject.should == adapter
|
127
|
-
end
|
127
|
+
:fakeweb => VCR::HttpStubbingAdapters::FakeWeb,
|
128
|
+
:webmock => VCR::HttpStubbingAdapters::WebMock
|
129
|
+
}.each do |symbol, klass|
|
130
|
+
it "returns #{klass} for :#{symbol}" do
|
131
|
+
VCR::Config.stub_with symbol
|
132
|
+
VCR.http_stubbing_adapter.should == klass
|
128
133
|
end
|
129
134
|
end
|
130
135
|
|
131
|
-
it 'raises an error
|
132
|
-
VCR::Config.
|
133
|
-
|
136
|
+
it 'raises an error if both :fakeweb and :webmock are configured' do
|
137
|
+
VCR::Config.stub_with :fakeweb, :webmock
|
138
|
+
|
139
|
+
expect { VCR.http_stubbing_adapter }.to raise_error(ArgumentError, /cannot use both/)
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'raises an error for unsupported stubbing libraries' do
|
143
|
+
VCR::Config.stub_with :unsupported_library
|
144
|
+
|
145
|
+
expect { VCR.http_stubbing_adapter }.to raise_error(ArgumentError, /unsupported_library is not a supported HTTP stubbing library/i)
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'raises an error when no stubbing libraries are configured' do
|
149
|
+
VCR::Config.stub_with
|
150
|
+
|
151
|
+
expect { VCR.http_stubbing_adapter }.to raise_error(ArgumentError, /the http stubbing library is not configured/i)
|
134
152
|
end
|
135
153
|
end
|
136
154
|
|
data/vcr.gemspec
CHANGED
@@ -22,12 +22,12 @@ Gem::Specification.new do |s|
|
|
22
22
|
'bundler' => '~> 1.0.0',
|
23
23
|
'rake' => '~> 0.8.7',
|
24
24
|
|
25
|
-
'rspec' => '~> 2.
|
26
|
-
'cucumber' => '~> 0.
|
25
|
+
'rspec' => '~> 2.1.0',
|
26
|
+
'cucumber' => '~> 0.9.4',
|
27
27
|
'aruba' => '~> 0.2.1',
|
28
28
|
|
29
29
|
'fakeweb' => '~> 1.3.0',
|
30
|
-
'webmock' => '
|
30
|
+
'webmock' => '>= 1.5.0',
|
31
31
|
|
32
32
|
'httpclient' => '~> 2.1.5.2',
|
33
33
|
|
@@ -40,7 +40,8 @@ Gem::Specification.new do |s|
|
|
40
40
|
{
|
41
41
|
'patron' => '~> 0.4.6',
|
42
42
|
'em-http-request' => '~> 0.2.7',
|
43
|
-
'curb' => '~> 0.7.8'
|
43
|
+
'curb' => '~> 0.7.8',
|
44
|
+
'typhoeus' => '~> 0.2.0'
|
44
45
|
}.each do |lib, version|
|
45
46
|
s.add_development_dependency lib, version
|
46
47
|
end unless RUBY_PLATFORM == 'java'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.3.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Myron Marston
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-11 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -89,12 +89,12 @@ dependencies:
|
|
89
89
|
requirements:
|
90
90
|
- - ~>
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
hash:
|
92
|
+
hash: 11
|
93
93
|
segments:
|
94
94
|
- 2
|
95
|
+
- 1
|
95
96
|
- 0
|
96
|
-
|
97
|
-
version: 2.0.0
|
97
|
+
version: 2.1.0
|
98
98
|
requirement: *id005
|
99
99
|
type: :development
|
100
100
|
name: rspec
|
@@ -153,12 +153,12 @@ dependencies:
|
|
153
153
|
requirements:
|
154
154
|
- - ~>
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
hash:
|
156
|
+
hash: 51
|
157
157
|
segments:
|
158
158
|
- 0
|
159
|
-
-
|
160
|
-
-
|
161
|
-
version: 0.
|
159
|
+
- 9
|
160
|
+
- 4
|
161
|
+
version: 0.9.4
|
162
162
|
requirement: *id009
|
163
163
|
type: :development
|
164
164
|
name: cucumber
|
@@ -167,14 +167,14 @@ dependencies:
|
|
167
167
|
version_requirements: &id010 !ruby/object:Gem::Requirement
|
168
168
|
none: false
|
169
169
|
requirements:
|
170
|
-
- -
|
170
|
+
- - ">="
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
hash:
|
172
|
+
hash: 3
|
173
173
|
segments:
|
174
174
|
- 1
|
175
|
-
-
|
175
|
+
- 5
|
176
176
|
- 0
|
177
|
-
version: 1.
|
177
|
+
version: 1.5.0
|
178
178
|
requirement: *id010
|
179
179
|
type: :development
|
180
180
|
name: webmock
|
@@ -227,6 +227,22 @@ dependencies:
|
|
227
227
|
type: :development
|
228
228
|
name: em-http-request
|
229
229
|
prerelease: false
|
230
|
+
- !ruby/object:Gem::Dependency
|
231
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
232
|
+
none: false
|
233
|
+
requirements:
|
234
|
+
- - ~>
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
hash: 23
|
237
|
+
segments:
|
238
|
+
- 0
|
239
|
+
- 2
|
240
|
+
- 0
|
241
|
+
version: 0.2.0
|
242
|
+
requirement: *id014
|
243
|
+
type: :development
|
244
|
+
name: typhoeus
|
245
|
+
prerelease: false
|
230
246
|
description: VCR provides helpers to record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests. It works with any ruby testing framework, and provides built-in support for cucumber.
|
231
247
|
email: myron.marston@gmail.com
|
232
248
|
executables: []
|
@@ -240,11 +256,14 @@ files:
|
|
240
256
|
- .gitignore
|
241
257
|
- .gitmodules
|
242
258
|
- CHANGELOG.md
|
259
|
+
- FullBuildRakeFile
|
243
260
|
- Gemfile
|
244
261
|
- Gemfile.lock
|
262
|
+
- Guardfile
|
245
263
|
- LICENSE
|
246
264
|
- README.md
|
247
265
|
- Rakefile
|
266
|
+
- TODO.md
|
248
267
|
- benchmarks/http_stubbing_libraries.rb
|
249
268
|
- features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/regex_cassette.yml
|
250
269
|
- features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette1.yml
|
@@ -276,7 +295,9 @@ files:
|
|
276
295
|
- features/step_definitions/vcr_steps.rb
|
277
296
|
- features/support/env.rb
|
278
297
|
- features/webmock.feature
|
298
|
+
- full_build
|
279
299
|
- lib/vcr.rb
|
300
|
+
- lib/vcr/basic_object.rb
|
280
301
|
- lib/vcr/cassette.rb
|
281
302
|
- lib/vcr/config.rb
|
282
303
|
- lib/vcr/cucumber_tags.rb
|
@@ -285,6 +306,8 @@ files:
|
|
285
306
|
- lib/vcr/extensions/net_http_response.rb
|
286
307
|
- lib/vcr/http_stubbing_adapters/common.rb
|
287
308
|
- lib/vcr/http_stubbing_adapters/fakeweb.rb
|
309
|
+
- lib/vcr/http_stubbing_adapters/multi_object_proxy.rb
|
310
|
+
- lib/vcr/http_stubbing_adapters/typhoeus.rb
|
288
311
|
- lib/vcr/http_stubbing_adapters/webmock.rb
|
289
312
|
- lib/vcr/internet_connection.rb
|
290
313
|
- lib/vcr/ping.rb
|
@@ -319,6 +342,8 @@ files:
|
|
319
342
|
- spec/fixtures/not_1.9.1/fake_example.com_responses.yml
|
320
343
|
- spec/fixtures/not_1.9.1/match_requests_on.yml
|
321
344
|
- spec/http_stubbing_adapters/fakeweb_spec.rb
|
345
|
+
- spec/http_stubbing_adapters/multi_object_proxy_spec.rb
|
346
|
+
- spec/http_stubbing_adapters/typhoeus_spec.rb
|
322
347
|
- spec/http_stubbing_adapters/webmock_spec.rb
|
323
348
|
- spec/internet_connection_spec.rb
|
324
349
|
- spec/monkey_patches.rb
|
@@ -334,6 +359,7 @@ files:
|
|
334
359
|
- spec/support/ruby_interpreter.rb
|
335
360
|
- spec/support/temp_cassette_library_dir.rb
|
336
361
|
- spec/support/vcr_localhost_server.rb
|
362
|
+
- spec/support/version_checker.rb
|
337
363
|
- spec/support/webmock_macros.rb
|
338
364
|
- spec/vcr_spec.rb
|
339
365
|
- spec/version_spec.rb
|
@@ -434,6 +460,8 @@ test_files:
|
|
434
460
|
- spec/fixtures/not_1.9.1/fake_example.com_responses.yml
|
435
461
|
- spec/fixtures/not_1.9.1/match_requests_on.yml
|
436
462
|
- spec/http_stubbing_adapters/fakeweb_spec.rb
|
463
|
+
- spec/http_stubbing_adapters/multi_object_proxy_spec.rb
|
464
|
+
- spec/http_stubbing_adapters/typhoeus_spec.rb
|
437
465
|
- spec/http_stubbing_adapters/webmock_spec.rb
|
438
466
|
- spec/internet_connection_spec.rb
|
439
467
|
- spec/monkey_patches.rb
|
@@ -449,6 +477,7 @@ test_files:
|
|
449
477
|
- spec/support/ruby_interpreter.rb
|
450
478
|
- spec/support/temp_cassette_library_dir.rb
|
451
479
|
- spec/support/vcr_localhost_server.rb
|
480
|
+
- spec/support/version_checker.rb
|
452
481
|
- spec/support/webmock_macros.rb
|
453
482
|
- spec/vcr_spec.rb
|
454
483
|
- spec/version_spec.rb
|