vcr 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -2
- data/.travis.yml +3 -1
- data/Appraisals +0 -4
- data/CHANGELOG.md +90 -54
- data/Gemfile +6 -6
- data/{gemfiles/typhoeus-new.gemfile.lock → Gemfile.lock} +34 -37
- data/LICENSE +1 -1
- data/README.md +14 -7
- data/Rakefile +8 -6
- data/cucumber.yml +10 -7
- data/features/.nav +3 -0
- data/features/configuration/preserve_exact_body_bytes.feature +2 -2
- data/features/configuration/query_parser.feature +84 -0
- data/features/configuration/uri_parser.feature +1 -1
- data/features/hooks/around_http_request.feature +1 -1
- data/features/request_matching/README.md +2 -0
- data/features/request_matching/query.feature +97 -0
- data/gemfiles/{typhoeus-old.gemfile → typhoeus_old.gemfile} +1 -3
- data/gemfiles/{typhoeus-old.gemfile.lock → typhoeus_old.gemfile.lock} +25 -17
- data/lib/vcr.rb +5 -1
- data/lib/vcr/configuration.rb +20 -0
- data/lib/vcr/deprecations.rb +62 -1
- data/lib/vcr/errors.rb +9 -9
- data/lib/vcr/library_hooks/fakeweb.rb +1 -0
- data/lib/vcr/library_hooks/typhoeus.rb +1 -0
- data/lib/vcr/library_hooks/webmock.rb +1 -1
- data/lib/vcr/request_matcher_registry.rb +8 -1
- data/lib/vcr/structs.rb +2 -2
- data/lib/vcr/test_frameworks/rspec.rb +0 -56
- data/lib/vcr/version.rb +1 -1
- data/script/ci.sh +2 -2
- data/spec/monkey_patches.rb +1 -1
- data/spec/spec_helper.rb +12 -13
- data/spec/support/http_library_adapters.rb +9 -1
- data/spec/vcr/deprecations_spec.rb +11 -9
- data/spec/vcr/library_hooks/fakeweb_spec.rb +5 -0
- data/spec/vcr/library_hooks/typhoeus_spec.rb +55 -0
- data/spec/vcr/request_matcher_registry_spec.rb +39 -0
- data/vcr.gemspec +4 -3
- metadata +79 -85
- data/gemfiles/typhoeus-new.gemfile +0 -18
data/Gemfile
CHANGED
@@ -2,9 +2,6 @@ source :rubygems
|
|
2
2
|
|
3
3
|
gem 'appraisal'
|
4
4
|
|
5
|
-
gem 'typhoeus', :git => "https://github.com/typhoeus/typhoeus.git"
|
6
|
-
gem 'webmock', :git => "https://github.com/i0rek/webmock.git", :branch => "typhoeus_0.5.0"
|
7
|
-
|
8
5
|
gemspec
|
9
6
|
|
10
7
|
gem 'jruby-openssl', :platforms => :jruby
|
@@ -16,10 +13,13 @@ gem 'relish', '~> 0.6'
|
|
16
13
|
gem 'fuubar'
|
17
14
|
gem 'fuubar-cucumber'
|
18
15
|
|
19
|
-
gem 'redcarpet', '~> 1.17.2'
|
16
|
+
gem 'redcarpet', '~> 1.17.2', :platforms => :ruby
|
20
17
|
gem 'github-markup'
|
21
18
|
|
22
|
-
|
19
|
+
group :extras do
|
20
|
+
gem 'ruby-debug', :platforms => [:mri_18, :jruby]
|
23
21
|
|
24
|
-
gem 'debugger', :platforms => :mri_19
|
22
|
+
gem 'debugger', :platforms => :mri_19
|
23
|
+
gem 'pry'
|
24
|
+
end
|
25
25
|
|
@@ -1,29 +1,13 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/i0rek/webmock.git
|
3
|
-
revision: aeac5cc6a1ac7a313c138514d66cd536802b9dc4
|
4
|
-
branch: typhoeus_0.5.0
|
5
|
-
specs:
|
6
|
-
webmock (1.8.9)
|
7
|
-
addressable (>= 2.2.7)
|
8
|
-
crack (>= 0.1.7)
|
9
|
-
|
10
|
-
GIT
|
11
|
-
remote: https://github.com/typhoeus/typhoeus.git
|
12
|
-
revision: 6f4e9079ade2f90c20341dddd022ab1d153400ec
|
13
|
-
specs:
|
14
|
-
typhoeus (0.5.0.rc)
|
15
|
-
ethon (= 0.5.1)
|
16
|
-
|
17
1
|
PATH
|
18
|
-
remote:
|
2
|
+
remote: .
|
19
3
|
specs:
|
20
|
-
vcr (2.
|
4
|
+
vcr (2.4.0)
|
21
5
|
|
22
6
|
GEM
|
23
7
|
remote: http://rubygems.org/
|
24
8
|
specs:
|
25
9
|
addressable (2.3.2)
|
26
|
-
appraisal (0.
|
10
|
+
appraisal (0.5.1)
|
27
11
|
bundler
|
28
12
|
rake
|
29
13
|
archive-tar-minitar (0.5.2)
|
@@ -35,6 +19,7 @@ GEM
|
|
35
19
|
builder (3.1.4)
|
36
20
|
childprocess (0.3.6)
|
37
21
|
ffi (~> 1.0, >= 1.0.6)
|
22
|
+
coderay (1.0.8)
|
38
23
|
columnize (0.3.6)
|
39
24
|
cookiejar (0.3.0)
|
40
25
|
crack (0.3.1)
|
@@ -44,14 +29,14 @@ GEM
|
|
44
29
|
gherkin (~> 2.9.0)
|
45
30
|
json (>= 1.4.6)
|
46
31
|
term-ansicolor (>= 1.0.6)
|
47
|
-
curb (0.8.
|
48
|
-
debugger (1.2.
|
32
|
+
curb (0.8.3)
|
33
|
+
debugger (1.2.2)
|
49
34
|
columnize (>= 0.3.1)
|
50
35
|
debugger-linecache (~> 1.1.1)
|
51
|
-
debugger-ruby_core_source (~> 1.1.
|
36
|
+
debugger-ruby_core_source (~> 1.1.5)
|
52
37
|
debugger-linecache (1.1.2)
|
53
38
|
debugger-ruby_core_source (>= 1.1.1)
|
54
|
-
debugger-ruby_core_source (1.1.
|
39
|
+
debugger-ruby_core_source (1.1.5)
|
55
40
|
diff-lcs (1.1.3)
|
56
41
|
em-http-request (1.0.3)
|
57
42
|
addressable (>= 2.2.3)
|
@@ -61,15 +46,15 @@ GEM
|
|
61
46
|
http_parser.rb (>= 0.5.3)
|
62
47
|
em-socksify (0.2.1)
|
63
48
|
eventmachine (>= 1.0.0.beta.4)
|
64
|
-
ethon (0.5.
|
65
|
-
ffi (~> 1.
|
49
|
+
ethon (0.5.6)
|
50
|
+
ffi (~> 1.1.5)
|
66
51
|
mime-types (~> 1.18)
|
67
52
|
eventmachine (1.0.0)
|
68
|
-
excon (0.16.
|
53
|
+
excon (0.16.10)
|
69
54
|
fakeweb (1.3.0)
|
70
55
|
faraday (0.8.4)
|
71
56
|
multipart-post (~> 1.1)
|
72
|
-
ffi (1.
|
57
|
+
ffi (1.1.5)
|
73
58
|
fuubar (1.0.0)
|
74
59
|
rspec (~> 2.0)
|
75
60
|
rspec-instafail (~> 0.2.0)
|
@@ -85,14 +70,19 @@ GEM
|
|
85
70
|
json (1.6.7)
|
86
71
|
linecache (0.46)
|
87
72
|
rbx-require-relative (> 0.0.4)
|
73
|
+
method_source (0.8.1)
|
88
74
|
mime-types (1.19)
|
89
75
|
multi_json (1.0.4)
|
90
76
|
multipart-post (1.1.5)
|
91
77
|
patron (0.4.18)
|
78
|
+
pry (0.9.10)
|
79
|
+
coderay (~> 1.0.5)
|
80
|
+
method_source (~> 0.8)
|
81
|
+
slop (~> 3.3.1)
|
92
82
|
rack (1.3.6)
|
93
83
|
rack-protection (1.2.0)
|
94
84
|
rack
|
95
|
-
rake (0.9.
|
85
|
+
rake (0.9.5)
|
96
86
|
rbx-require-relative (0.0.9)
|
97
87
|
redcarpet (1.17.2)
|
98
88
|
redis (2.2.2)
|
@@ -102,15 +92,15 @@ GEM
|
|
102
92
|
rest-client (>= 1.6.1)
|
103
93
|
rest-client (1.6.7)
|
104
94
|
mime-types (>= 1.16)
|
105
|
-
rspec (2.
|
106
|
-
rspec-core (~> 2.
|
107
|
-
rspec-expectations (~> 2.
|
108
|
-
rspec-mocks (~> 2.
|
109
|
-
rspec-core (2.
|
110
|
-
rspec-expectations (2.
|
95
|
+
rspec (2.12.0)
|
96
|
+
rspec-core (~> 2.12.0)
|
97
|
+
rspec-expectations (~> 2.12.0)
|
98
|
+
rspec-mocks (~> 2.12.0)
|
99
|
+
rspec-core (2.12.0)
|
100
|
+
rspec-expectations (2.12.0)
|
111
101
|
diff-lcs (~> 1.1.3)
|
112
102
|
rspec-instafail (0.2.4)
|
113
|
-
rspec-mocks (2.
|
103
|
+
rspec-mocks (2.12.0)
|
114
104
|
ruby-debug (0.10.4)
|
115
105
|
columnize (>= 0.1)
|
116
106
|
ruby-debug-base (~> 0.10.4.0)
|
@@ -126,9 +116,15 @@ GEM
|
|
126
116
|
rack (~> 1.3, >= 1.3.6)
|
127
117
|
rack-protection (~> 1.2)
|
128
118
|
tilt (~> 1.3, >= 1.3.3)
|
119
|
+
slop (3.3.3)
|
129
120
|
term-ansicolor (1.0.7)
|
130
121
|
tilt (1.3.3)
|
131
122
|
timecop (0.3.5)
|
123
|
+
typhoeus (0.5.3)
|
124
|
+
ethon (~> 0.5.3)
|
125
|
+
webmock (1.9.0)
|
126
|
+
addressable (>= 2.2.7)
|
127
|
+
crack (>= 0.1.7)
|
132
128
|
yajl-ruby (1.1.0)
|
133
129
|
yard (0.8.3)
|
134
130
|
|
@@ -154,6 +150,7 @@ DEPENDENCIES
|
|
154
150
|
json (~> 1.6.5)
|
155
151
|
multi_json (~> 1.0.3)
|
156
152
|
patron (~> 0.4.15)
|
153
|
+
pry
|
157
154
|
rack (~> 1.3.6)
|
158
155
|
rake (~> 0.9.2)
|
159
156
|
redcarpet (~> 1.17.2)
|
@@ -165,8 +162,8 @@ DEPENDENCIES
|
|
165
162
|
simplecov (~> 0.5.3)
|
166
163
|
sinatra (~> 1.3.2)
|
167
164
|
timecop (~> 0.3.5)
|
168
|
-
typhoeus
|
165
|
+
typhoeus (~> 0.5.3)
|
169
166
|
vcr!
|
170
|
-
webmock
|
167
|
+
webmock (~> 1.9)
|
171
168
|
yajl-ruby (~> 1.1.0)
|
172
169
|
yard
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
|
4
4
|
|
5
|
-
[![Build Status](https://secure.travis-ci.org/
|
5
|
+
[![Build Status](https://secure.travis-ci.org/vcr/vcr.png?branch=master)](http://travis-ci.org/vcr/vcr)
|
6
6
|
|
7
7
|
## Synopsis
|
8
8
|
|
@@ -79,7 +79,7 @@ The docs come in two flavors:
|
|
79
79
|
API documentation. The API docs contain detailed info about all of VCR's
|
80
80
|
public API.
|
81
81
|
|
82
|
-
See the [Upgrade](https://github.com/
|
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
85
|
## Release Policy
|
@@ -105,13 +105,13 @@ Note that as of VCR 2, 1.8.6 and 1.9.1 are not supported.
|
|
105
105
|
|
106
106
|
## Development
|
107
107
|
|
108
|
-
* Source hosted on [GitHub](http://github.com/
|
108
|
+
* Source hosted on [GitHub](http://github.com/vcr/vcr).
|
109
109
|
* Direct questions and discussions to the [IRC channel](irc://irc.freenode.net/vcr) or
|
110
110
|
the [mailing list](http://groups.google.com/group/vcr-ruby).
|
111
|
-
* Report issues on [GitHub Issues](http://github.com/
|
111
|
+
* Report issues on [GitHub Issues](http://github.com/vcr/vcr/issues).
|
112
112
|
* Pull requests are very welcome! Please include spec and/or feature coverage for every patch,
|
113
113
|
and create a topic branch for every separate change you make.
|
114
|
-
* See the [Contributing](https://github.com/
|
114
|
+
* See the [Contributing](https://github.com/vcr/vcr/blob/master/CONTRIBUTING.md)
|
115
115
|
guide for instructions on running the specs and features.
|
116
116
|
* Code quality metrics are checked by [Code Climate](https://codeclimate.com/github/myronmarston/vcr).
|
117
117
|
* Documentation is generated with [YARD](http://yardoc.org/) ([cheat sheet](http://cheat.errtheblog.com/s/yard/)).
|
@@ -138,6 +138,7 @@ yard server --reload
|
|
138
138
|
Thanks also to the following people who have contributed patches or helpful suggestions:
|
139
139
|
|
140
140
|
* [Aaron Brethorst](http://github.com/aaronbrethorst)
|
141
|
+
* [Austen Ito](https://github.com/austenito)
|
141
142
|
* [Avdi Grimm](https://github.com/avdi)
|
142
143
|
* [Bartosz Blimke](http://github.com/bblimke)
|
143
144
|
* [Benjamin Oakes](https://github.com/benjaminoakes)
|
@@ -158,6 +159,7 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
158
159
|
* [Jonathan Tron](https://github.com/JonathanTron)
|
159
160
|
* [Justin Smestad](https://github.com/jsmestad)
|
160
161
|
* [Karl Baum](https://github.com/kbaum)
|
162
|
+
* [Luke van der Hoeven](https://github.com/plukevdh)
|
161
163
|
* [Mark Burns](https://github.com/markburns)
|
162
164
|
* [Michael Lavrisha](https://github.com/vrish88)
|
163
165
|
* [Mislav Marohnić](https://github.com/mislav)
|
@@ -168,7 +170,11 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
168
170
|
* [playupchris](https://github.com/playupchris)
|
169
171
|
* [Ryan Bates](https://github.com/ryanb)
|
170
172
|
* [Ryan Burrows](https://github.com/rhburrows)
|
173
|
+
* [Ryan Castillo](https://github.com/rmcastil)
|
171
174
|
* [Sathya Sekaran](https://github.com/sfsekaran)
|
175
|
+
* [Scott Carleton](https://github.com/ScotterC)
|
176
|
+
* [Shay Frendt](https://github.com/shayfrendt)
|
177
|
+
* [Steve Faulkner](https://github.com/southpolesteve)
|
172
178
|
* [Steven Anderson](https://github.com/bendycode)
|
173
179
|
* [Tyler Hunt](https://github.com/tylerhunt)
|
174
180
|
* [Wesley Beary](https://github.com/geemus)
|
@@ -178,10 +184,11 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
178
184
|
* [Betamax](https://github.com/robfletcher/betamax) (Groovy)
|
179
185
|
* [Mimic](https://github.com/acoulton/mimic) (PHP/Kohana)
|
180
186
|
* [Nock](https://github.com/flatiron/nock) (JavaScript/Node)
|
181
|
-
* [NSURLConnectionVCR](https://bitbucket.org/martijnthe/nsurlconnectionvcr) (Objective
|
187
|
+
* [NSURLConnectionVCR](https://bitbucket.org/martijnthe/nsurlconnectionvcr) (Objective-C)
|
182
188
|
* [TapeDeck.js](https://github.com/EndangeredMassa/TapeDeck.js) (JavaScript)
|
183
189
|
* [VCR.js](https://github.com/elcuervo/vcr.js) (JavaScript)
|
184
190
|
* [VCR.py](https://github.com/kevin1024/vcrpy) (Python)
|
191
|
+
* [VCRURLConnection](https://github.com/dstnbrkr/VCRURLConnection) (Objective-C)
|
185
192
|
* [vcr-clj](https://github.com/ifesdjeen/vcr-clj) (Clojure)
|
186
193
|
|
187
194
|
## Similar Libraries in Ruby
|
@@ -195,5 +202,5 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
195
202
|
|
196
203
|
## Copyright
|
197
204
|
|
198
|
-
Copyright (c) 2010-
|
205
|
+
Copyright (c) 2010-2013 Myron Marston. Released under the terms of the
|
199
206
|
MIT license. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -88,13 +88,15 @@ end
|
|
88
88
|
|
89
89
|
desc "Push cukes to relishapp using the relish-client-gem"
|
90
90
|
task :relish do
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
unless ENV['SKIP_RELISH']
|
92
|
+
%w[ README.md CHANGELOG.md Upgrade.md LICENSE CONTRIBUTING.md].each do |file|
|
93
|
+
ensure_relish_doc_symlinked(file)
|
94
|
+
end
|
94
95
|
|
95
|
-
|
96
|
-
|
97
|
-
|
96
|
+
require 'vcr/version'
|
97
|
+
sh "relish versions:add vcr/vcr:#{VCR.version}" if ENV['NEW_RELISH_RELEASE']
|
98
|
+
sh "relish push vcr/vcr:#{VCR.version}"
|
99
|
+
end
|
98
100
|
end
|
99
101
|
|
100
102
|
task :prep_relish_release do
|
data/cucumber.yml
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
<%
|
2
|
+
base_opts = '--require features/step_definitions --require features/support'
|
3
|
+
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'Cucumber::Formatter::Fuubar'} --strict"
|
2
4
|
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
|
3
5
|
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'Cucumber::Formatter::Fuubar'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
|
4
|
-
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'Cucumber::Formatter::Fuubar'} --strict"
|
5
6
|
|
6
|
-
exclusions = [
|
7
|
-
|
8
|
-
|
7
|
+
exclusions = []
|
8
|
+
exclusions << "--tags ~@exclude-#{RUBY_VERSION.split('.').first(2).join}"
|
9
|
+
exclusions << "--tags ~@exclude-#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}"
|
10
|
+
exclusions << "--tags ~@exclude-#{RUBY_ENGINE}" if defined?(RUBY_ENGINE)
|
11
|
+
exclusions = exclusions.join(' ')
|
9
12
|
%>
|
10
|
-
default: <%= std_opts %> --tags ~@wip <%= exclusions %> features
|
11
|
-
wip: --tags @wip <%= exclusions %> features
|
12
|
-
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip <%= exclusions %>
|
13
|
+
default: <%= base_opts %> <%= std_opts %> --tags ~@wip <%= exclusions %> features
|
14
|
+
wip: <%= base_opts %> --tags @wip <%= exclusions %> features
|
15
|
+
rerun: <%= base_opts %> <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip <%= exclusions %>
|
13
16
|
|
data/features/.nav
CHANGED
@@ -29,6 +29,8 @@
|
|
29
29
|
- allow_http_connections_when_no_cassette.feature
|
30
30
|
- debug_logging.feature
|
31
31
|
- preserve_exact_body_bytes.feature
|
32
|
+
- uri_parser.feature
|
33
|
+
- query_parser.feature
|
32
34
|
- hooks:
|
33
35
|
- before_record.feature
|
34
36
|
- before_playback.feature
|
@@ -40,6 +42,7 @@
|
|
40
42
|
- uri.feature
|
41
43
|
- host.feature
|
42
44
|
- path.feature
|
45
|
+
- query.feature
|
43
46
|
- body.feature
|
44
47
|
- headers.feature
|
45
48
|
- identical_request_sequence.feature
|
@@ -32,7 +32,7 @@ Feature: Preserve Exact Body Bytes
|
|
32
32
|
|
33
33
|
VCR.configure do |c|
|
34
34
|
c.cassette_library_dir = 'cassettes'
|
35
|
-
c.hook_into :
|
35
|
+
c.hook_into :webmock
|
36
36
|
c.preserve_exact_body_bytes do |http_message|
|
37
37
|
http_message.body.encoding.name == 'ASCII-8BIT' ||
|
38
38
|
!http_message.body.valid_encoding?
|
@@ -79,7 +79,7 @@ Feature: Preserve Exact Body Bytes
|
|
79
79
|
|
80
80
|
VCR.configure do |c|
|
81
81
|
c.cassette_library_dir = 'cassettes'
|
82
|
-
c.hook_into :
|
82
|
+
c.hook_into :webmock
|
83
83
|
c.default_cassette_options = { :serialize_with => :json }
|
84
84
|
end
|
85
85
|
|
@@ -0,0 +1,84 @@
|
|
1
|
+
Feature: query_parser
|
2
|
+
|
3
|
+
By default, VCR will parse query strings using `CGI.parse` from the Ruby
|
4
|
+
standard library. This may not be the most optimal or performant library
|
5
|
+
available. You can set the `query_parser` configuration option to use a
|
6
|
+
different parser (such as `Rack::Utils.method(:parse_query)`) to decode,
|
7
|
+
normalize, and/or provide a comparison object for query strings.
|
8
|
+
|
9
|
+
The configured query parser needs to expose a `.call` method that returns an
|
10
|
+
object which is comparable. This instance needs to implement the following
|
11
|
+
API:
|
12
|
+
|
13
|
+
* `#==` => boolean
|
14
|
+
|
15
|
+
Background:
|
16
|
+
Given a file named "cassettes/example.yml" with:
|
17
|
+
"""
|
18
|
+
---
|
19
|
+
http_interactions:
|
20
|
+
- request:
|
21
|
+
method: get
|
22
|
+
uri: http://url.example.com/?bravo=2&alpha=1
|
23
|
+
body:
|
24
|
+
encoding: UTF-8
|
25
|
+
string: ""
|
26
|
+
headers: {}
|
27
|
+
response:
|
28
|
+
status:
|
29
|
+
code: 200
|
30
|
+
message: OK
|
31
|
+
headers:
|
32
|
+
Content-Length:
|
33
|
+
- "5"
|
34
|
+
body:
|
35
|
+
encoding: UTF-8
|
36
|
+
string: Hello
|
37
|
+
http_version: "1.1"
|
38
|
+
recorded_at: Tue, 25 Sep 2012 04:58:44 GMT
|
39
|
+
recorded_with: VCR 2.2.5
|
40
|
+
"""
|
41
|
+
|
42
|
+
Scenario: the VCR query parser gets its value from `query_parser`
|
43
|
+
Given a file named "query_parser.rb" with:
|
44
|
+
"""ruby
|
45
|
+
require 'vcr'
|
46
|
+
require 'rack'
|
47
|
+
|
48
|
+
VCR.configure do |c|
|
49
|
+
c.query_parser = lambda { |query| raise query.inspect }
|
50
|
+
c.default_cassette_options = {:match_requests_on => [:query]}
|
51
|
+
c.hook_into :webmock
|
52
|
+
c.cassette_library_dir = 'cassettes'
|
53
|
+
end
|
54
|
+
|
55
|
+
uri = URI.parse('http://other-url.example.com/?bravo=2&alpha=1')
|
56
|
+
VCR.use_cassette('example') do
|
57
|
+
puts Net::HTTP.get_response(uri).body
|
58
|
+
end
|
59
|
+
"""
|
60
|
+
When I run `ruby query_parser.rb`
|
61
|
+
Then it should fail with an error like:
|
62
|
+
"""
|
63
|
+
"alpha=1&bravo=2"
|
64
|
+
"""
|
65
|
+
|
66
|
+
|
67
|
+
Scenario: the `query_parser` defaults to the standard library's `CGI.parse`
|
68
|
+
Given a file named "query_parser_default.rb" with:
|
69
|
+
"""ruby
|
70
|
+
require 'vcr'
|
71
|
+
|
72
|
+
VCR.configure do |c|
|
73
|
+
c.hook_into :webmock
|
74
|
+
c.default_cassette_options = {:match_requests_on => [:query]}
|
75
|
+
c.cassette_library_dir = 'cassettes'
|
76
|
+
end
|
77
|
+
|
78
|
+
uri = URI.parse('http://other-url.example.com/?bravo=2&alpha=1')
|
79
|
+
VCR.use_cassette('example') do
|
80
|
+
puts Net::HTTP.get_response(uri).body
|
81
|
+
end
|
82
|
+
"""
|
83
|
+
When I run `ruby query_parser_default.rb`
|
84
|
+
Then it should pass with "Hello"
|
@@ -8,7 +8,7 @@ Feature: uri_parser
|
|
8
8
|
|
9
9
|
The configured URI parser needs to expose a `.parse` class method
|
10
10
|
that returns an instance of the uri. This uri instance needs to
|
11
|
-
implement the
|
11
|
+
implement the following API:
|
12
12
|
|
13
13
|
* `#scheme` => a string
|
14
14
|
* `#host` => a string
|