vcr 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +6 -6
- data/LICENSE +1 -1
- data/README.md +10 -3
- data/features/hooks/before_record.feature +4 -4
- data/features/http_libraries/net_http.feature +1 -1
- data/features/request_matching/headers.feature +0 -1
- data/features/step_definitions/cli_steps.rb +1 -1
- data/lib/vcr/library_hooks/fakeweb.rb +1 -1
- data/lib/vcr/library_hooks/typhoeus.rb +1 -1
- data/lib/vcr/library_hooks/typhoeus_0.4.rb +1 -1
- data/lib/vcr/library_hooks/webmock.rb +1 -1
- data/lib/vcr/middleware/excon.rb +1 -1
- data/lib/vcr/middleware/faraday.rb +1 -1
- data/lib/vcr/util/version_checker.rb +7 -23
- data/lib/vcr/version.rb +1 -1
- data/spec/support/http_library_adapters.rb +5 -1
- data/spec/vcr/util/version_checker_spec.rb +9 -23
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzZkYzJkMTc5OTlhMGM0ZDZiMzNkZDcwYzA5YTRlZTJiNDRiYjFjYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmQwMDFiY2JjOWRmYjhjOWM5MTg2MGE4ZTcxMDIwMjk5NzJiMDg1NA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzA4NzhmNGE3ODQ1YzcxYTFkNmVmM2E1ZmMxM2JlYjkxNTVmNDk0Yzc4MDZh
|
10
|
+
NjQ3M2Y0ODgwYjA3YjkwM2NkNWU2NGJlYzk3ZWMxMjY1MTRiMGJlNjFmODU3
|
11
|
+
NGZjNWFiNzQ4NzdmYzVhMjdhOGRmMTEyZGQ0NDE2NjE1OGE2ZWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTUxNWE4ZDkzNzMwZGRkNDcyOTRiNjU5MDA3NDRkOTQ1MGVlYzA3MGE5OWRm
|
14
|
+
ZGI0OTAzMzNkNjQ2MjNlNDkyNzg3Nzg2NDk1NGRkYzJjNDY2NGY0NzI3NWY3
|
15
|
+
Zjc5ODQ4ZWY0MmY3ZTNmZWVkZjg5NjA2MTA1NGZkMTk3NDhjZTU=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 2.9.0 (March 27, 2014)
|
2
|
+
|
3
|
+
[Full Changelog](http://github.com/vcr/vcr/compare/v2.8.0...v2.9.0)
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Update version checking to only assert that a given library is >=
|
8
|
+
a minimum version. (Ryan Foster)
|
9
|
+
* Explicitly support the latest Excon release (0.32). (Ryan Foster)
|
10
|
+
* Explicitly support the latest Excon release (0.31). (Michiel de Mare)
|
11
|
+
* Explicitly support the latest Webmock releases (1.16, 1.17).
|
12
|
+
(Ryan Foster, Lawson Kurtz)
|
13
|
+
|
1
14
|
## 2.8.0 (November 23, 2013)
|
2
15
|
|
3
16
|
[Full Changelog](http://github.com/vcr/vcr/compare/v2.7.0...v2.8.0)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vcr (2.
|
4
|
+
vcr (2.9.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -21,8 +21,8 @@ GEM
|
|
21
21
|
coderay (1.0.9)
|
22
22
|
columnize (0.3.6)
|
23
23
|
cookiejar (0.3.0)
|
24
|
-
crack (0.4.
|
25
|
-
safe_yaml (~> 0.
|
24
|
+
crack (0.4.2)
|
25
|
+
safe_yaml (~> 1.0.0)
|
26
26
|
cucumber (1.3.8)
|
27
27
|
builder (>= 2.1.2)
|
28
28
|
diff-lcs (>= 1.1.3)
|
@@ -49,7 +49,7 @@ GEM
|
|
49
49
|
ffi (>= 1.3.0)
|
50
50
|
mime-types (~> 1.18)
|
51
51
|
eventmachine (1.0.3)
|
52
|
-
excon (0.
|
52
|
+
excon (0.32.0)
|
53
53
|
fakeweb (1.3.0)
|
54
54
|
faraday (0.8.8)
|
55
55
|
multipart-post (~> 1.2.0)
|
@@ -100,7 +100,7 @@ GEM
|
|
100
100
|
ruby-debug-base (~> 0.10.4.0)
|
101
101
|
ruby-debug-base (0.10.4)
|
102
102
|
linecache (>= 0.3)
|
103
|
-
safe_yaml (0.
|
103
|
+
safe_yaml (1.0.1)
|
104
104
|
simplecov (0.7.1)
|
105
105
|
multi_json (~> 1.0)
|
106
106
|
simplecov-html (~> 0.7.1)
|
@@ -114,7 +114,7 @@ GEM
|
|
114
114
|
timecop (0.6.1)
|
115
115
|
typhoeus (0.6.6)
|
116
116
|
ethon (~> 0.6.1)
|
117
|
-
webmock (1.
|
117
|
+
webmock (1.17.3)
|
118
118
|
addressable (>= 2.2.7)
|
119
119
|
crack (>= 0.3.2)
|
120
120
|
yajl-ruby (1.1.0)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -82,6 +82,8 @@ The docs come in two flavors:
|
|
82
82
|
See the [Upgrade](https://github.com/vcr/vcr/blob/master/Upgrade.md) doc
|
83
83
|
for info about what's new and changed in VCR 2.0.
|
84
84
|
|
85
|
+
There is also a Railscast, which will get you up and running in no-time http://railscasts.com/episodes/291-testing-with-vcr
|
86
|
+
|
85
87
|
## Release Policy
|
86
88
|
|
87
89
|
VCR follows the principles of [semantic versioning](http://semver.org/).
|
@@ -115,7 +117,7 @@ Note that as of VCR 2, 1.8.6 and 1.9.1 are not supported.
|
|
115
117
|
* See the [Contributing](https://github.com/vcr/vcr/blob/master/CONTRIBUTING.md)
|
116
118
|
guide for instructions on running the specs and features.
|
117
119
|
* Code quality metrics are checked by [Code Climate](https://codeclimate.com/github/vcr/vcr).
|
118
|
-
* Documentation is generated with [YARD](http://yardoc.org/) ([cheat sheet](http://cheat.errtheblog.com/s/yard
|
120
|
+
* Documentation is generated with [YARD](http://yardoc.org/) ([cheat sheet](http://cheat.errtheblog.com/s/yard)).
|
119
121
|
To generate while developing:
|
120
122
|
|
121
123
|
```
|
@@ -173,6 +175,7 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
173
175
|
* [Mark Burns](https://github.com/markburns)
|
174
176
|
* [Max Riveiro](https://github.com/kavu)
|
175
177
|
* [Michael Lavrisha](https://github.com/vrish88)
|
178
|
+
* [Michiel de Mare](https://github.com/mdemare)
|
176
179
|
* [Mike Dalton](https://github.com/kcdragon)
|
177
180
|
* [Mislav Marohnić](https://github.com/mislav)
|
178
181
|
* [Nathaniel Bibler](https://github.com/nbibler)
|
@@ -201,12 +204,16 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
201
204
|
|
202
205
|
* [Betamax](https://github.com/robfletcher/betamax) (Groovy/JVM)
|
203
206
|
* [Betamax](https://github.com/sigmavirus24/betamax) (Python)
|
207
|
+
* [Betamax](https://github.com/thegreatape/betamax) (Go)
|
208
|
+
* [Betamax](https://github.com/wjlroe/betamax) (Clojure)
|
209
|
+
* [Betamax.NET](https://github.com/mfloryan/Betamax.Net) (C#/.NET)
|
204
210
|
* [ExVCR](https://github.com/parroty/exvcr) (Elixir)
|
205
211
|
* [HAVCR](https://github.com/cordawyn/havcr) (Haskell)
|
206
212
|
* [Mimic](https://github.com/acoulton/mimic) (PHP/Kohana)
|
207
213
|
* [Nock-VCR](https://github.com/carbonfive/nock-vcr) (JavaScript/Node)
|
208
214
|
* [NSURLConnectionVCR](https://bitbucket.org/martijnthe/nsurlconnectionvcr) (Objective-C)
|
209
215
|
* [PHP-VCR](https://github.com/php-vcr/php-vcr) (PHP)
|
216
|
+
* [Sepia](https://github.com/linkedin/sepia) (Javascript/Node)
|
210
217
|
* [TapeDeck.js](https://github.com/EndangeredMassa/TapeDeck.js) (JavaScript)
|
211
218
|
* [VCR.js](https://github.com/elcuervo/vcr.js) (JavaScript)
|
212
219
|
* [VCR.py](https://github.com/kevin1024/vcrpy) (Python)
|
@@ -220,11 +227,11 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
220
227
|
* [Net::HTTP Spy](http://github.com/martinbtt/net-http-spy)
|
221
228
|
* [NetRecorder](https://github.com/chrisyoung/netrecorder)
|
222
229
|
* [Puffing Billy](https://github.com/oesmith/puffing-billy)
|
223
|
-
* [REST-assured](https://github.com/
|
230
|
+
* [REST-assured](https://github.com/artemave/REST-assured)
|
224
231
|
* [Stale Fish](https://github.com/jsmestad/stale_fish)
|
225
232
|
* [WebFixtures](http://github.com/trydionel/web_fixtures)
|
226
233
|
|
227
234
|
## Copyright
|
228
235
|
|
229
|
-
Copyright (c) 2010-
|
236
|
+
Copyright (c) 2010-2014 Myron Marston. Released under the terms of the
|
230
237
|
MIT license. See LICENSE for details.
|
@@ -7,11 +7,11 @@ Feature: before_record hook
|
|
7
7
|
the HTTP interaction that is about to be written to disk. The second
|
8
8
|
argument will be the current cassette.
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
If you wish to prevent VCR from recording the HTTP interaction you can call
|
11
|
+
`#ignore!` on the interaction.
|
12
12
|
|
13
|
-
If you don't your hook to apply to all cassettes, you can use tags
|
14
|
-
|
13
|
+
If you don't want your hook to apply to all cassettes, you can use tags to
|
14
|
+
select which cassettes a given hook applies to. Consider this code:
|
15
15
|
|
16
16
|
VCR.configure do |c|
|
17
17
|
c.before_record(:twitter) { ... } # modify the interactions somehow
|
@@ -144,7 +144,7 @@ Feature: Net::HTTP
|
|
144
144
|
c.cassette_library_dir = 'cassettes'
|
145
145
|
end
|
146
146
|
|
147
|
-
uri = URI("https://gist.
|
147
|
+
uri = URI("https://gist.githubusercontent.com/myronmarston/fb555cb593f3349d53af/raw/6921dd638337d3f6a51b0e02e7f30e3c414f70d6/vcr_gist")
|
148
148
|
|
149
149
|
VCR.use_cassette('https') do
|
150
150
|
http = Net::HTTP.new(uri.host, uri.port)
|
@@ -36,7 +36,7 @@ module VCRHelpers
|
|
36
36
|
# Remove non-deterministic headers and headers
|
37
37
|
# that get added by a particular HTTP library (but not by others)
|
38
38
|
i.response.headers.reject! { |k, v| %w[ server date connection ].include?(k) }
|
39
|
-
i.request.headers.reject! { |k, v| %w[ accept user-agent connection expect ].include?(k) }
|
39
|
+
i.request.headers.reject! { |k, v| %w[ accept user-agent connection expect date ].include?(k) }
|
40
40
|
|
41
41
|
# Some HTTP libraries include an extra space ("OK " instead of "OK")
|
42
42
|
i.response.status.message = i.response.status.message.strip
|
@@ -5,7 +5,7 @@ require 'vcr/extensions/net_http_response'
|
|
5
5
|
require 'vcr/request_handler'
|
6
6
|
require 'set'
|
7
7
|
|
8
|
-
VCR::VersionChecker.new('FakeWeb', FakeWeb::VERSION, '1.3.0'
|
8
|
+
VCR::VersionChecker.new('FakeWeb', FakeWeb::VERSION, '1.3.0').check_version!
|
9
9
|
|
10
10
|
module VCR
|
11
11
|
class LibraryHooks
|
@@ -5,7 +5,7 @@ require 'typhoeus'
|
|
5
5
|
if Float(Typhoeus::VERSION[/^\d+\.\d+/]) < 0.5
|
6
6
|
require 'vcr/library_hooks/typhoeus_0.4'
|
7
7
|
else
|
8
|
-
VCR::VersionChecker.new('Typhoeus', Typhoeus::VERSION, '0.5.0'
|
8
|
+
VCR::VersionChecker.new('Typhoeus', Typhoeus::VERSION, '0.5.0').check_version!
|
9
9
|
|
10
10
|
module VCR
|
11
11
|
class LibraryHooks
|
@@ -2,7 +2,7 @@ require 'vcr/util/version_checker'
|
|
2
2
|
require 'vcr/request_handler'
|
3
3
|
require 'webmock'
|
4
4
|
|
5
|
-
VCR::VersionChecker.new('WebMock', WebMock.version, '1.8.0'
|
5
|
+
VCR::VersionChecker.new('WebMock', WebMock.version, '1.8.0').check_version!
|
6
6
|
|
7
7
|
module VCR
|
8
8
|
class LibraryHooks
|
data/lib/vcr/middleware/excon.rb
CHANGED
@@ -2,7 +2,7 @@ require 'excon'
|
|
2
2
|
require 'vcr/request_handler'
|
3
3
|
require 'vcr/util/version_checker'
|
4
4
|
|
5
|
-
VCR::VersionChecker.new('Excon', Excon::VERSION, '0.25.2'
|
5
|
+
VCR::VersionChecker.new('Excon', Excon::VERSION, '0.25.2').check_version!
|
6
6
|
|
7
7
|
module VCR
|
8
8
|
# Contains middlewares for use with different libraries.
|
@@ -2,7 +2,7 @@ require 'faraday'
|
|
2
2
|
require 'vcr/util/version_checker'
|
3
3
|
require 'vcr/request_handler'
|
4
4
|
|
5
|
-
VCR::VersionChecker.new('Faraday', Faraday::VERSION, '0.7.0'
|
5
|
+
VCR::VersionChecker.new('Faraday', Faraday::VERSION, '0.7.0').check_version!
|
6
6
|
|
7
7
|
module VCR
|
8
8
|
# Contains middlewares for use with different libraries.
|
@@ -1,30 +1,23 @@
|
|
1
1
|
module VCR
|
2
2
|
# @private
|
3
3
|
class VersionChecker
|
4
|
-
def initialize(library_name, library_version,
|
5
|
-
@library_name
|
6
|
-
@
|
4
|
+
def initialize(library_name, library_version, min_version)
|
5
|
+
@library_name = library_name
|
6
|
+
@library_version = library_version
|
7
|
+
@min_version = min_version
|
7
8
|
|
8
9
|
@major, @minor, @patch = parse_version(library_version)
|
9
|
-
@min_major, @min_minor, @min_patch = parse_version(
|
10
|
-
@max_major, @max_minor = parse_version(max_minor_version)
|
11
|
-
|
12
|
-
@comparison_result = compare_version
|
10
|
+
@min_major, @min_minor, @min_patch = parse_version(min_version)
|
13
11
|
end
|
14
12
|
|
15
13
|
def check_version!
|
16
14
|
raise_too_low_error if too_low?
|
17
|
-
warn_about_too_high if too_high?
|
18
15
|
end
|
19
16
|
|
20
17
|
private
|
21
18
|
|
22
19
|
def too_low?
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
def too_high?
|
27
|
-
@comparison_result == :too_high
|
20
|
+
compare_version == :too_low
|
28
21
|
end
|
29
22
|
|
30
23
|
def raise_too_low_error
|
@@ -33,27 +26,18 @@ module VCR
|
|
33
26
|
"VCR requires version #{version_requirement}."
|
34
27
|
end
|
35
28
|
|
36
|
-
def warn_about_too_high
|
37
|
-
Kernel.warn "You are using #{@library_name} #{@library_version}. " +
|
38
|
-
"VCR #{VCR.version} has been tested against #{@library_name} #{version_requirement}, " +
|
39
|
-
"and you are using a newer version. If you experience VCR issues, " +
|
40
|
-
"consider downgrading #{@library_name} as it may fix it."
|
41
|
-
end
|
42
|
-
|
43
29
|
def compare_version
|
44
30
|
case
|
45
31
|
when @major < @min_major then :too_low
|
46
|
-
when @major > @max_major then :too_high
|
47
32
|
when @major > @min_major then :ok
|
48
33
|
when @minor < @min_minor then :too_low
|
49
|
-
when @minor > @max_minor then :too_high
|
50
34
|
when @minor > @min_minor then :ok
|
51
35
|
when @patch < @min_patch then :too_low
|
52
36
|
end
|
53
37
|
end
|
54
38
|
|
55
39
|
def version_requirement
|
56
|
-
">= #{@
|
40
|
+
">= #{@min_version}"
|
57
41
|
end
|
58
42
|
|
59
43
|
def parse_version(version)
|
data/lib/vcr/version.rb
CHANGED
@@ -85,7 +85,11 @@ HTTP_LIBRARY_ADAPTERS['httpclient'] = Module.new do
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def normalize_request_headers(headers)
|
88
|
-
headers
|
88
|
+
headers.merge({
|
89
|
+
'Accept' => ["*/*"],
|
90
|
+
'User-Agent' => ["HTTPClient/1.0 (#{HTTPClient::VERSION}, ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}))"],
|
91
|
+
'Date' => [Time.now.httpdate]
|
92
|
+
})
|
89
93
|
end
|
90
94
|
end
|
91
95
|
|
@@ -3,42 +3,28 @@ require 'spec_helper'
|
|
3
3
|
module VCR
|
4
4
|
describe VersionChecker do
|
5
5
|
it 'raises an error if the major version is too low' do
|
6
|
-
checker = VersionChecker.new('foo', '0.7.3', '1.0.0'
|
6
|
+
checker = VersionChecker.new('foo', '0.7.3', '1.0.0')
|
7
7
|
expect { checker.check_version! }.to raise_error(Errors::LibraryVersionTooLowError)
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'raises an error if the minor version is too low' do
|
11
|
-
checker = VersionChecker.new('foo', '1.0.99', '1.1.3'
|
11
|
+
checker = VersionChecker.new('foo', '1.0.99', '1.1.3')
|
12
12
|
expect { checker.check_version! }.to raise_error(Errors::LibraryVersionTooLowError)
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'raises an error if the patch version is too low' do
|
16
|
-
checker = VersionChecker.new('foo', '1.0.8', '1.0.10'
|
16
|
+
checker = VersionChecker.new('foo', '1.0.8', '1.0.10')
|
17
17
|
expect { checker.check_version! }.to raise_error(Errors::LibraryVersionTooLowError)
|
18
18
|
end
|
19
19
|
|
20
|
-
it '
|
21
|
-
checker = VersionChecker.new('foo', '
|
22
|
-
expect
|
23
|
-
checker.check_version!
|
20
|
+
it 'does not raise an error when the version is equal' do
|
21
|
+
checker = VersionChecker.new('foo', '1.0.0', '1.0.0')
|
22
|
+
expect { checker.check_version! }.not_to raise_error
|
24
23
|
end
|
25
24
|
|
26
|
-
it '
|
27
|
-
checker = VersionChecker.new('foo', '
|
28
|
-
expect
|
29
|
-
checker.check_version!
|
30
|
-
end
|
31
|
-
|
32
|
-
it 'does not raise an error or print a warning when the major version is between the min and max' do
|
33
|
-
checker = VersionChecker.new('foo', '2.0.0', '1.0.0', '3.0')
|
34
|
-
expect(Kernel).not_to receive(:warn)
|
35
|
-
checker.check_version!
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'does not raise an error or print a warning when the min_patch is 0.6.5, the max_minor is 0.7 and the version is 0.7.3' do
|
39
|
-
checker = VersionChecker.new('foo', '0.7.3', '0.6.5', '0.7')
|
40
|
-
expect(Kernel).not_to receive(:warn)
|
41
|
-
checker.check_version!
|
25
|
+
it 'does not raise an error when the version is higher' do
|
26
|
+
checker = VersionChecker.new('foo', '2.0.0', '1.0.0')
|
27
|
+
expect { checker.check_version! }.not_to raise_error
|
42
28
|
end
|
43
29
|
end
|
44
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myron Marston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: VCR provides a simple API to record and replay your test suite's HTTP
|
14
14
|
interactions. It works with a variety of HTTP client libraries, HTTP stubbing libraries
|