vcr 2.6.0 → 2.7.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 +27 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +16 -16
- data/README.md +3 -0
- data/lib/vcr/cassette/persisters/file_system.rb +5 -1
- data/lib/vcr/library_hooks/typhoeus.rb +11 -1
- data/lib/vcr/library_hooks/webmock.rb +1 -1
- data/lib/vcr/middleware/excon.rb +11 -25
- data/lib/vcr/middleware/excon/legacy_methods.rb +33 -0
- data/lib/vcr/middleware/faraday.rb +1 -1
- data/lib/vcr/util/version_checker.rb +3 -2
- data/lib/vcr/version.rb +1 -1
- data/spec/support/sinatra_app.rb +4 -0
- data/spec/vcr/cassette/persisters/file_system_spec.rb +5 -0
- data/spec/vcr/cassette/serializers_spec.rb +1 -3
- data/spec/vcr/library_hooks/typhoeus_spec.rb +21 -4
- data/spec/vcr/middleware/faraday_spec.rb +10 -0
- data/spec/vcr/util/version_checker_spec.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWRhMTJmODMwZTRlMWQ4YzFiMGRlZmY4ZTE5NmM4OWQyZDNlYzM0ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjU3OGExMjk0NWI2MjVhYTM2NGEzNTRhOGJlMWJlMzFiNzBkMjRkYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTI5ZDI3NDdmNmI4ZTY1NTFmNTBkN2Q1NGViYTc5MTkzNzhmNDY3MDJkMmQ1
|
10
|
+
ZTVjNTk0YzVkOTM0MjVkN2U0ZTVmNTIzZGViYTFiYzVlYmM0MjM2NWFiNThl
|
11
|
+
MGI1YTg3ZDc3MTcwMjJiMmY1MzA1YWMzNzBhMWJmMThhZGE5YmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTIwY2QzNmRkOTczOGNmYmQxNzg2N2E0NjI4YjgyMTRiYzMzMTFmODA3ZGZm
|
14
|
+
ZDdlNGFmNjg5NmY4YWQ4YzM0ZjA4YzIwZGIwYjdlZjViZmFkMDM1NTZmOTJi
|
15
|
+
ZWFiNDhmMzllZjI5OTgwOTM0OWI2ZjgxNmM3ZmYxMzFlMGQwZmM=
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
## 2.7.0 (October 31, 2013)
|
2
|
+
|
3
|
+
[Full Changelog](http://github.com/vcr/vcr/compare/v2.6.0...v2.7.0)
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* Explicitly support the latest WebMock releases (1.14 and 1.15).
|
8
|
+
(Eduardo Maia, Johannes Würbach)
|
9
|
+
* Explicitly support the latest Excon releases (0.27 and 0.28).
|
10
|
+
(Myron Marston)
|
11
|
+
* Add support for Excon unix sockets by leveraging its
|
12
|
+
new `::Excon::Utils.request_uri` method. (Todd Lunter)
|
13
|
+
* Reword the "it may not work with this version" warning
|
14
|
+
message so the intent is more clear (Myron Marston).
|
15
|
+
* Support post/put bodies being specified as a hash when
|
16
|
+
using Typhoeus by leveraging it's new `encoded_body` API.
|
17
|
+
(Myron Marston, Hans Hasselberg)
|
18
|
+
|
19
|
+
Bug Fixes:
|
20
|
+
|
21
|
+
* Fix detection of encoding errors for MultiJson 1.8.1+.
|
22
|
+
(Myron Marston).
|
23
|
+
* Fix file name sanitization to better handle paths that have
|
24
|
+
a dot in them (Rob Hanlon, Myron Marston).
|
25
|
+
* Fix Faraday middleware so that it works properly when another
|
26
|
+
adapter is exclusively enabled (Myron Marston).
|
27
|
+
|
1
28
|
## 2.6.0 (September 25, 2013)
|
2
29
|
|
3
30
|
[Full Changelog](http://github.com/vcr/vcr/compare/v2.5.0...v2.6.0)
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vcr (2.
|
4
|
+
vcr (2.7.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -29,15 +29,15 @@ GEM
|
|
29
29
|
gherkin (~> 2.12.1)
|
30
30
|
multi_json (>= 1.7.5, < 2.0)
|
31
31
|
multi_test (>= 0.0.2)
|
32
|
-
curb (0.8.
|
33
|
-
debugger (1.6.
|
32
|
+
curb (0.8.5)
|
33
|
+
debugger (1.6.2)
|
34
34
|
columnize (>= 0.3.1)
|
35
35
|
debugger-linecache (~> 1.2.0)
|
36
36
|
debugger-ruby_core_source (~> 1.2.3)
|
37
37
|
debugger-linecache (1.2.0)
|
38
38
|
debugger-ruby_core_source (1.2.3)
|
39
39
|
diff-lcs (1.2.4)
|
40
|
-
em-http-request (1.1.
|
40
|
+
em-http-request (1.1.1)
|
41
41
|
addressable (>= 2.3.4)
|
42
42
|
cookiejar
|
43
43
|
em-socksify (>= 0.3)
|
@@ -49,11 +49,11 @@ 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.28.0)
|
53
53
|
fakeweb (1.3.0)
|
54
54
|
faraday (0.8.8)
|
55
55
|
multipart-post (~> 1.2.0)
|
56
|
-
ffi (1.9.
|
56
|
+
ffi (1.9.3)
|
57
57
|
fuubar (1.2.1)
|
58
58
|
rspec (~> 2.0)
|
59
59
|
rspec-instafail (~> 0.2.0)
|
@@ -61,17 +61,17 @@ GEM
|
|
61
61
|
fuubar-cucumber (0.0.20)
|
62
62
|
cucumber (~> 1.3.0)
|
63
63
|
ruby-progressbar (~> 1.0.0)
|
64
|
-
gherkin (2.12.
|
64
|
+
gherkin (2.12.2)
|
65
65
|
multi_json (~> 1.3)
|
66
66
|
github-markup (0.7.5)
|
67
67
|
http_parser.rb (0.6.0.beta.2)
|
68
68
|
httpclient (2.3.4.1)
|
69
|
-
json (1.8.
|
69
|
+
json (1.8.1)
|
70
70
|
linecache (0.46)
|
71
71
|
rbx-require-relative (> 0.0.4)
|
72
72
|
method_source (0.8.2)
|
73
73
|
mime-types (1.25)
|
74
|
-
multi_json (1.8.
|
74
|
+
multi_json (1.8.2)
|
75
75
|
multi_test (0.0.2)
|
76
76
|
multipart-post (1.2.0)
|
77
77
|
patron (0.4.18)
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
rake (10.1.0)
|
86
86
|
rbx-require-relative (0.0.9)
|
87
87
|
redcarpet (1.17.2)
|
88
|
-
redis (3.0.
|
88
|
+
redis (3.0.5)
|
89
89
|
relish (0.7)
|
90
90
|
archive-tar-minitar (>= 0.5.2)
|
91
91
|
json (>= 1.4.6)
|
@@ -96,11 +96,11 @@ GEM
|
|
96
96
|
rspec-core (~> 2.14.0)
|
97
97
|
rspec-expectations (~> 2.14.0)
|
98
98
|
rspec-mocks (~> 2.14.0)
|
99
|
-
rspec-core (2.14.
|
100
|
-
rspec-expectations (2.14.
|
99
|
+
rspec-core (2.14.6)
|
100
|
+
rspec-expectations (2.14.3)
|
101
101
|
diff-lcs (>= 1.1.3, < 2.0)
|
102
102
|
rspec-instafail (0.2.4)
|
103
|
-
rspec-mocks (2.14.
|
103
|
+
rspec-mocks (2.14.4)
|
104
104
|
ruby-debug (0.10.4)
|
105
105
|
columnize (>= 0.1)
|
106
106
|
ruby-debug-base (~> 0.10.4.0)
|
@@ -119,9 +119,9 @@ GEM
|
|
119
119
|
slop (3.4.6)
|
120
120
|
tilt (1.4.1)
|
121
121
|
timecop (0.6.1)
|
122
|
-
typhoeus (0.6.
|
122
|
+
typhoeus (0.6.6)
|
123
123
|
ethon (~> 0.6.1)
|
124
|
-
webmock (1.
|
124
|
+
webmock (1.15.0)
|
125
125
|
addressable (>= 2.2.7)
|
126
126
|
crack (>= 0.3.2)
|
127
127
|
yajl-ruby (1.1.0)
|
@@ -161,6 +161,6 @@ DEPENDENCIES
|
|
161
161
|
timecop (= 0.6.1)
|
162
162
|
typhoeus (>= 0.6)
|
163
163
|
vcr!
|
164
|
-
webmock (>= 1.
|
164
|
+
webmock (>= 1.14)
|
165
165
|
yajl-ruby (>= 1.1.0)
|
166
166
|
yard
|
data/README.md
CHANGED
@@ -148,6 +148,7 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
148
148
|
* [Carlos Kirkconnell](https://github.com/kirkconnell)
|
149
149
|
* [Chad Jolly](https://github.com/cjolly)
|
150
150
|
* [Chris Le](https://github.com/chrisle)
|
151
|
+
* [Eduardo Maia](https://github.com/emaiax)
|
151
152
|
* [Eric Allam](http://github.com/rubymaverick)
|
152
153
|
* [Ezekiel Templin](https://github.com/ezkl)
|
153
154
|
* [Flaviu Simihaian](https://github.com/closedbracket)
|
@@ -184,6 +185,7 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
184
185
|
* [Shay Frendt](https://github.com/shayfrendt)
|
185
186
|
* [Steve Faulkner](https://github.com/southpolesteve)
|
186
187
|
* [Stephen Anderson](https://github.com/bendycode)
|
188
|
+
* [Todd Lunter](https://github.com/tlunter)
|
187
189
|
* [Tyler Hunt](https://github.com/tylerhunt)
|
188
190
|
* [Uģis Ozols](https://github.com/ugisozols)
|
189
191
|
* [vzvu3k6k](https://github.com/vzvu3k6k)
|
@@ -193,6 +195,7 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
193
195
|
|
194
196
|
* [Betamax](https://github.com/robfletcher/betamax) (Groovy/JVM)
|
195
197
|
* [Betamax](https://github.com/sigmavirus24/betamax) (Python)
|
198
|
+
* [ExVCR](https://github.com/parroty/exvcr) (Elixir)
|
196
199
|
* [HAVCR](https://github.com/cordawyn/havcr) (Haskell)
|
197
200
|
* [Mimic](https://github.com/acoulton/mimic) (PHP/Kohana)
|
198
201
|
* [Nock-VCR](https://github.com/carbonfive/nock-vcr) (JavaScript/Node)
|
@@ -51,7 +51,11 @@ module VCR
|
|
51
51
|
|
52
52
|
def sanitized_file_name_from(file_name)
|
53
53
|
parts = file_name.to_s.split('.')
|
54
|
-
|
54
|
+
|
55
|
+
if parts.size > 1 && !parts.last.include?(File::SEPARATOR)
|
56
|
+
file_extension = '.' + parts.pop
|
57
|
+
end
|
58
|
+
|
55
59
|
parts.join('.').gsub(/[^\w\-\/]+/, '_') + file_extension.to_s
|
56
60
|
end
|
57
61
|
end
|
@@ -23,7 +23,7 @@ else
|
|
23
23
|
@vcr_request ||= VCR::Request.new \
|
24
24
|
request.options.fetch(:method, :get),
|
25
25
|
request.url,
|
26
|
-
|
26
|
+
request_body,
|
27
27
|
request.options.fetch(:headers, {})
|
28
28
|
end
|
29
29
|
|
@@ -61,6 +61,16 @@ else
|
|
61
61
|
end if stubbed_response.headers
|
62
62
|
end
|
63
63
|
end
|
64
|
+
|
65
|
+
if ::Typhoeus::Request.method_defined?(:encoded_body)
|
66
|
+
def request_body
|
67
|
+
request.encoded_body
|
68
|
+
end
|
69
|
+
else
|
70
|
+
def request_body
|
71
|
+
request.options.fetch(:body, "")
|
72
|
+
end
|
73
|
+
end
|
64
74
|
end
|
65
75
|
|
66
76
|
# @private
|
@@ -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', '1.
|
5
|
+
VCR::VersionChecker.new('WebMock', WebMock.version, '1.8.0', '1.15').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.22.0', '0.
|
5
|
+
VCR::VersionChecker.new('Excon', Excon::VERSION, '0.22.0', '0.28').check_version!
|
6
6
|
|
7
7
|
module VCR
|
8
8
|
# Contains middlewares for use with different libraries.
|
@@ -164,30 +164,16 @@ module VCR
|
|
164
164
|
normalized
|
165
165
|
end
|
166
166
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
when Hash
|
178
|
-
qry = '?'
|
179
|
-
for key, values in request_params[:query]
|
180
|
-
if values.nil?
|
181
|
-
qry << key.to_s << '&'
|
182
|
-
else
|
183
|
-
for value in [*values]
|
184
|
-
qry << key.to_s << '=' << CGI.escape(value.to_s) << '&'
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
qry.chop! # remove trailing '&'
|
189
|
-
else
|
190
|
-
''
|
167
|
+
if defined?(::Excon::Utils) && ::Excon::Utils.respond_to?(:request_uri)
|
168
|
+
def uri
|
169
|
+
@uri ||= "#{::Excon::Utils.request_uri(request_params)}"
|
170
|
+
end
|
171
|
+
else
|
172
|
+
require 'vcr/middleware/excon/legacy_methods'
|
173
|
+
include LegacyMethods
|
174
|
+
|
175
|
+
def uri
|
176
|
+
@uri ||= "#{request_params[:scheme]}://#{request_params[:host]}:#{request_params[:port]}#{request_params[:path]}#{query}"
|
191
177
|
end
|
192
178
|
end
|
193
179
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module VCR
|
2
|
+
module Middleware
|
3
|
+
class Excon
|
4
|
+
# Contains legacy methods only needed when integrating with older versions
|
5
|
+
# of Excon.
|
6
|
+
# @api private
|
7
|
+
module LegacyMethods
|
8
|
+
# based on:
|
9
|
+
# https://github.com/geemus/excon/blob/v0.7.8/lib/excon/connection.rb#L117-132
|
10
|
+
def query
|
11
|
+
@query ||= case request_params[:query]
|
12
|
+
when String
|
13
|
+
"?#{request_params[:query]}"
|
14
|
+
when Hash
|
15
|
+
qry = '?'
|
16
|
+
for key, values in request_params[:query]
|
17
|
+
if values.nil?
|
18
|
+
qry << key.to_s << '&'
|
19
|
+
else
|
20
|
+
for value in [*values]
|
21
|
+
qry << key.to_s << '=' << CGI.escape(value.to_s) << '&'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
qry.chop! # remove trailing '&'
|
26
|
+
else
|
27
|
+
''
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -35,8 +35,9 @@ module VCR
|
|
35
35
|
|
36
36
|
def warn_about_too_high
|
37
37
|
Kernel.warn "You are using #{@library_name} #{@library_version}. " +
|
38
|
-
"VCR
|
39
|
-
"
|
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."
|
40
41
|
end
|
41
42
|
|
42
43
|
def compare_version
|
data/lib/vcr/version.rb
CHANGED
data/spec/support/sinatra_app.rb
CHANGED
@@ -56,6 +56,11 @@ module VCR
|
|
56
56
|
expected = File.join(FileSystem.storage_location, "a_1/b")
|
57
57
|
expect(FileSystem.absolute_path_to_file("a 1/b")).to eq(expected)
|
58
58
|
end
|
59
|
+
|
60
|
+
it 'handles files with no extensions (even when there is a dot in the path)' do
|
61
|
+
expected = File.join(FileSystem.storage_location, "/foo_bar/baz_qux")
|
62
|
+
expect(FileSystem.absolute_path_to_file("/foo.bar/baz qux")).to eq(expected)
|
63
|
+
end
|
59
64
|
end
|
60
65
|
end
|
61
66
|
end
|
@@ -71,10 +71,8 @@ module VCR
|
|
71
71
|
|
72
72
|
if RUBY_INTERPRETER == :jruby
|
73
73
|
# don't test yajl on jruby
|
74
|
-
elsif RUBY_VERSION.to_f < 1.9
|
75
|
-
engines[:yajl] = MultiJson::LoadError
|
76
74
|
else
|
77
|
-
engines[:yajl] =
|
75
|
+
engines[:yajl] = MultiJson::LoadError
|
78
76
|
end
|
79
77
|
|
80
78
|
if RUBY_VERSION =~ /1.9/
|
@@ -84,13 +84,30 @@ describe "Typhoeus hook", :with_monkey_patches => :typhoeus do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it 'records and replays headers correctly' do
|
87
|
-
|
88
|
-
|
89
|
-
played_back = get_response
|
87
|
+
recorded = get_response
|
88
|
+
played_back = get_response
|
90
89
|
|
91
|
-
|
90
|
+
expect(played_back.headers).to eq(recorded.headers)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
context 'when a request is made with a hash for the POST body' do
|
95
|
+
def make_request
|
96
|
+
VCR.use_cassette("hash_body") do
|
97
|
+
Typhoeus::Request.post(
|
98
|
+
"http://localhost:#{VCR::SinatraApp.port}/return-request-body",
|
99
|
+
:body => { :foo => "17" }
|
100
|
+
)
|
92
101
|
end
|
93
102
|
end
|
103
|
+
|
104
|
+
it 'records and replays correctly' do
|
105
|
+
recorded = make_request
|
106
|
+
played_back = make_request
|
107
|
+
|
108
|
+
expect(recorded.body).to eq("foo=17")
|
109
|
+
expect(played_back.body).to eq(recorded.body)
|
110
|
+
end
|
94
111
|
end
|
95
112
|
|
96
113
|
context '#effective_url' do
|
@@ -128,6 +128,16 @@ describe VCR::Middleware::Faraday do
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
+
context "when another adapter is exclusive" do
|
132
|
+
it 'still makes requests properly' do
|
133
|
+
response = VCR.library_hooks.exclusively_enabled(:typhoeus) do
|
134
|
+
Faraday.get("http://localhost:#{VCR::SinatraApp.port}/")
|
135
|
+
end
|
136
|
+
|
137
|
+
expect(response.body).to eq("GET to root")
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
131
141
|
context 'for a recorded request' do
|
132
142
|
let!(:inserted_cassette) { VCR.insert_cassette('new_cassette') }
|
133
143
|
before(:each) { expect(VCR).to receive(:record_http_interaction) }
|
@@ -19,13 +19,13 @@ module VCR
|
|
19
19
|
|
20
20
|
it 'prints a warning if the major version is too high' do
|
21
21
|
checker = VersionChecker.new('foo', '2.0.0', '1.0.0', '1.1')
|
22
|
-
expect(Kernel).to receive(:warn).with(/
|
22
|
+
expect(Kernel).to receive(:warn).with(/you are using a newer version/)
|
23
23
|
checker.check_version!
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'prints a warning if the minor version is too high' do
|
27
27
|
checker = VersionChecker.new('foo', '1.2.0', '1.0.0', '1.1')
|
28
|
-
expect(Kernel).to receive(:warn).with(/
|
28
|
+
expect(Kernel).to receive(:warn).with(/you are using a newer version/)
|
29
29
|
checker.check_version!
|
30
30
|
end
|
31
31
|
|
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.7.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: 2013-
|
11
|
+
date: 2013-10-31 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
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/vcr/library_hooks/typhoeus_0.4.rb
|
121
121
|
- lib/vcr/library_hooks/webmock.rb
|
122
122
|
- lib/vcr/middleware/excon.rb
|
123
|
+
- lib/vcr/middleware/excon/legacy_methods.rb
|
123
124
|
- lib/vcr/middleware/faraday.rb
|
124
125
|
- lib/vcr/middleware/rack.rb
|
125
126
|
- lib/vcr/request_handler.rb
|