vcr 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +10 -0
- data/README.md +39 -2
- data/lib/vcr/cucumber_tags.rb +4 -9
- data/lib/vcr/http_stubbing_adapters/webmock.rb +1 -1
- data/lib/vcr/version.rb +1 -1
- data/lib/vcr/version.rbc +1 -1
- metadata +56 -38
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
#Changelog
|
2
2
|
|
3
|
+
## 1.0.3 (August 5, 2010)
|
4
|
+
|
5
|
+
* Upgraded VCR specs to RSpec 2.
|
6
|
+
* Updated `VCR::CucumberTags` so that it uses an `around` hook rather than a `before` hook and an `after` hook.
|
7
|
+
Around hooks were added to Cucumber in the 0.7.3 release, so you'll have to be on that version or higher to use
|
8
|
+
the `VCR::CucumberTags` feature.
|
9
|
+
* Updated the WebMock version requirement to 1.3.3 or greater. 1.3.2 and earlier versions did not properly handle
|
10
|
+
multiple value for the same response header.
|
11
|
+
* Miscellaneous documentation updates.
|
12
|
+
|
3
13
|
## 1.0.2 (July 6, 2010)
|
4
14
|
|
5
15
|
* Fixed VCR to work with [rest-client](http://github.com/archiloque/rest-client). Rest-client extends the Net::HTTP
|
data/README.md
CHANGED
@@ -56,7 +56,8 @@ maintenance) and accurate (the response from example.com will contain the same h
|
|
56
56
|
## Development
|
57
57
|
|
58
58
|
* Source hosted on [GitHub](http://github.com/myronmarston/vcr).
|
59
|
-
*
|
59
|
+
* Direct questions and discussions to the [mailing list](http://groups.google.com/group/vcr-ruby).
|
60
|
+
* Report issues on [GitHub Issues](http://github.com/myronmarston/vcr/issues).
|
60
61
|
* Pull requests are very welcome! Please include spec and/or feature coverage for every patch,
|
61
62
|
and create a topic branch for every separate change you make.
|
62
63
|
|
@@ -127,11 +128,25 @@ Alternately, you can insert and eject a cassette with individual method calls fr
|
|
127
128
|
|
128
129
|
it "does something that makes an HTTP request"
|
129
130
|
|
131
|
+
it "does something else that makes an HTTP request"
|
132
|
+
|
130
133
|
after(:each) do
|
131
134
|
VCR.eject_cassette
|
132
135
|
end
|
133
136
|
end
|
134
137
|
|
138
|
+
If you're using RSpec 2, you can use the new `around` hook:
|
139
|
+
|
140
|
+
describe "Some object that makes an HTTP request" do
|
141
|
+
around(:each) do |example|
|
142
|
+
VCR.use_cassette('geocoding/Seattle, WA', :record => :new_episodes, &example)
|
143
|
+
end
|
144
|
+
|
145
|
+
it "does something that makes an HTTP request"
|
146
|
+
|
147
|
+
it "does something else that makes an HTTP request"
|
148
|
+
end
|
149
|
+
|
135
150
|
## Usage with Cucumber
|
136
151
|
|
137
152
|
VCR provides additional support for cucumber. You can of course use `VCR.use_cassette` within a step definition,
|
@@ -226,10 +241,20 @@ additional features. You can see the
|
|
226
241
|
[benchmarks](http://github.com/myronmarston/vcr/blob/master/benchmarks/http_stubbing_libraries.rb) for
|
227
242
|
more details.
|
228
243
|
|
244
|
+
Note that FakeWeb also currently has a bug that prevents it from properly dealing with multiple values
|
245
|
+
for the same response header. See [this FakeWeb issue](http://github.com/chrisk/fakeweb/issues/17) for
|
246
|
+
more info.
|
247
|
+
|
248
|
+
You should not need to directly interact with either FakeWeb or WebMock. VCR will take care of disallowing
|
249
|
+
http connections when no cassette is inserted, and it will clean up all stubs/registrations when a cassette
|
250
|
+
is ejected. If you ever decide to switch HTTP stubbing libraries, you'll just have to update the VCR config
|
251
|
+
setting.
|
252
|
+
|
229
253
|
## Suggested Workflow
|
230
254
|
|
231
255
|
First, configure VCR as I have above. I like setting the default record mode to `:none`
|
232
|
-
so that no new HTTP requests are made without me explicitly allowing it
|
256
|
+
so that no new HTTP requests are made without me explicitly allowing it, but if you may prefer to
|
257
|
+
set it to `:new_episodes`.
|
233
258
|
|
234
259
|
When an HTTP request is made, you'll get an error such as:
|
235
260
|
|
@@ -257,6 +282,9 @@ record the HTTP interaction. I usually remove the record mode at this point so
|
|
257
282
|
of `:none` in the future. Future test runs will get the recorded response, and if your code changes so
|
258
283
|
that it is making a new HTTP request, you'll be notified by an error as shown above.
|
259
284
|
|
285
|
+
VCR is designed to be used very granularly. Rather than inserting a global cassette, I recommend you wrap individual
|
286
|
+
blocks of code in `VCR.use_cassette` and record logically grouped sets of requests.
|
287
|
+
|
260
288
|
## Ruby Interpreter Compatibility
|
261
289
|
|
262
290
|
VCR has been tested on the following ruby interpreters:
|
@@ -298,6 +326,15 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
298
326
|
* [Ben Hutton](http://github.com/benhutton)
|
299
327
|
* [Eric Allam](http://github.com/rubymaverick)
|
300
328
|
|
329
|
+
## Similar Libraries
|
330
|
+
|
331
|
+
If VCR doesn't meet your needs, please [open an issue](http://github.com/myronmarston/vcr/issues) and let me know
|
332
|
+
how VCR could be improved. You may also want to try one of these similar libraries:
|
333
|
+
|
334
|
+
* [Stale Fish](http://github.com/jsmestad/stale_fish)
|
335
|
+
* [NetRecorder](http://github.com/chrisyoung/netrecorder)
|
336
|
+
* [Ephemeral Response](http://github.com/sandro/ephemeral_response)
|
337
|
+
|
301
338
|
## Copyright
|
302
339
|
|
303
340
|
Copyright (c) 2010 Myron Marston. See LICENSE for details.
|
data/lib/vcr/cucumber_tags.rb
CHANGED
@@ -21,18 +21,13 @@ module VCR
|
|
21
21
|
tag_name = "@#{tag_name}" unless tag_name =~ /^@/
|
22
22
|
cassette_name = "cucumber_tags/#{tag_name.gsub(/\A@/, '')}"
|
23
23
|
|
24
|
-
@main_object.
|
25
|
-
|
26
|
-
VCR.insert_cassette(cassette_name, options)
|
27
|
-
end
|
28
|
-
|
29
|
-
After(tag_name) do
|
30
|
-
VCR.eject_cassette
|
31
|
-
end
|
24
|
+
@main_object.Around(tag_name) do |scenario, block|
|
25
|
+
VCR.use_cassette(cassette_name, options, &block)
|
32
26
|
end
|
27
|
+
|
33
28
|
self.class.add_tag(tag_name)
|
34
29
|
end
|
35
30
|
end
|
36
31
|
alias :tag :tags
|
37
32
|
end
|
38
|
-
end
|
33
|
+
end
|
data/lib/vcr/version.rb
CHANGED
data/lib/vcr/version.rbc
CHANGED
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: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
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-08-05 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -25,14 +25,16 @@ dependencies:
|
|
25
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 62196421
|
31
31
|
segments:
|
32
|
-
-
|
33
|
-
- 3
|
32
|
+
- 2
|
34
33
|
- 0
|
35
|
-
|
34
|
+
- 0
|
35
|
+
- beta
|
36
|
+
- 19
|
37
|
+
version: 2.0.0.beta.19
|
36
38
|
requirement: *id001
|
37
39
|
- !ruby/object:Gem::Dependency
|
38
40
|
type: :development
|
@@ -43,12 +45,12 @@ dependencies:
|
|
43
45
|
requirements:
|
44
46
|
- - ">="
|
45
47
|
- !ruby/object:Gem::Version
|
46
|
-
hash:
|
48
|
+
hash: 53
|
47
49
|
segments:
|
48
50
|
- 0
|
49
|
-
-
|
50
|
-
-
|
51
|
-
version: 0.
|
51
|
+
- 8
|
52
|
+
- 5
|
53
|
+
version: 0.8.5
|
52
54
|
requirement: *id002
|
53
55
|
- !ruby/object:Gem::Dependency
|
54
56
|
type: :development
|
@@ -75,12 +77,12 @@ dependencies:
|
|
75
77
|
requirements:
|
76
78
|
- - ~>
|
77
79
|
- !ruby/object:Gem::Version
|
78
|
-
hash:
|
80
|
+
hash: 29
|
79
81
|
segments:
|
80
82
|
- 1
|
81
83
|
- 3
|
82
|
-
-
|
83
|
-
version: 1.3.
|
84
|
+
- 3
|
85
|
+
version: 1.3.3
|
84
86
|
requirement: *id004
|
85
87
|
- !ruby/object:Gem::Dependency
|
86
88
|
type: :development
|
@@ -102,67 +104,83 @@ dependencies:
|
|
102
104
|
- !ruby/object:Gem::Dependency
|
103
105
|
type: :development
|
104
106
|
prerelease: false
|
105
|
-
name:
|
107
|
+
name: capybara
|
106
108
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
107
109
|
none: false
|
108
110
|
requirements:
|
109
111
|
- - ~>
|
110
112
|
- !ruby/object:Gem::Version
|
111
|
-
hash:
|
113
|
+
hash: 1
|
112
114
|
segments:
|
113
115
|
- 0
|
114
|
-
-
|
115
|
-
-
|
116
|
-
version: 0.
|
116
|
+
- 3
|
117
|
+
- 9
|
118
|
+
version: 0.3.9
|
117
119
|
requirement: *id006
|
118
120
|
- !ruby/object:Gem::Dependency
|
119
121
|
type: :development
|
120
122
|
prerelease: false
|
121
|
-
name:
|
123
|
+
name: rack
|
122
124
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
123
125
|
none: false
|
124
126
|
requirements:
|
125
|
-
- -
|
127
|
+
- - "="
|
126
128
|
- !ruby/object:Gem::Version
|
127
|
-
hash:
|
129
|
+
hash: 31
|
128
130
|
segments:
|
129
|
-
-
|
131
|
+
- 1
|
130
132
|
- 2
|
131
|
-
-
|
132
|
-
version:
|
133
|
+
- 0
|
134
|
+
version: 1.2.0
|
133
135
|
requirement: *id007
|
134
136
|
- !ruby/object:Gem::Dependency
|
135
137
|
type: :development
|
136
138
|
prerelease: false
|
137
|
-
name:
|
139
|
+
name: rake
|
138
140
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
139
141
|
none: false
|
140
142
|
requirements:
|
141
143
|
- - ~>
|
142
144
|
- !ruby/object:Gem::Version
|
143
|
-
hash:
|
145
|
+
hash: 49
|
144
146
|
segments:
|
145
147
|
- 0
|
146
|
-
-
|
147
|
-
-
|
148
|
-
version: 0.
|
148
|
+
- 8
|
149
|
+
- 7
|
150
|
+
version: 0.8.7
|
149
151
|
requirement: *id008
|
150
152
|
- !ruby/object:Gem::Dependency
|
151
153
|
type: :development
|
152
154
|
prerelease: false
|
153
|
-
name:
|
155
|
+
name: patron
|
154
156
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
155
157
|
none: false
|
156
158
|
requirements:
|
157
|
-
- -
|
159
|
+
- - ~>
|
158
160
|
- !ruby/object:Gem::Version
|
159
|
-
hash:
|
161
|
+
hash: 3
|
160
162
|
segments:
|
161
|
-
- 1
|
162
|
-
- 2
|
163
163
|
- 0
|
164
|
-
|
164
|
+
- 4
|
165
|
+
- 6
|
166
|
+
version: 0.4.6
|
165
167
|
requirement: *id009
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
type: :development
|
170
|
+
prerelease: false
|
171
|
+
name: em-http-request
|
172
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - "="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
hash: 25
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
- 2
|
181
|
+
- 7
|
182
|
+
version: 0.2.7
|
183
|
+
requirement: *id010
|
166
184
|
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.
|
167
185
|
email: myron.marston@gmail.com
|
168
186
|
executables: []
|