vcr 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +4 -2
- data/CHANGELOG.md +15 -1
- data/README.md +23 -20
- data/features/.nav +1 -0
- data/features/cassettes/naming.feature +29 -0
- data/features/cassettes/no_cassette.feature +46 -1
- data/features/configuration/stub_with.feature +1 -1
- data/features/test_frameworks/cucumber.feature +6 -2
- data/lib/vcr.rb +24 -12
- data/lib/vcr/middleware/rack.rb +9 -2
- data/lib/vcr/structs/normalizers/header.rb +16 -8
- data/lib/vcr/version.rb +1 -1
- data/spec/spec_helper.rb +2 -1
- data/spec/support/http_library_adapters.rb +2 -1
- data/spec/support/shared_example_groups/normalizers.rb +12 -0
- data/spec/support/sinatra_app.rb +7 -1
- data/spec/support/vcr_localhost_server.rb +4 -2
- data/spec/vcr/cassette_spec.rb +1 -1
- data/spec/vcr/middleware/rack_spec.rb +20 -0
- data/spec/vcr_spec.rb +31 -0
- data/vcr.gemspec +3 -2
- metadata +100 -84
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
## In git
|
2
2
|
|
3
|
-
[Full Changelog](http://github.com/myronmarston/vcr/compare/v1.
|
3
|
+
[Full Changelog](http://github.com/myronmarston/vcr/compare/v1.10.0...master)
|
4
|
+
|
5
|
+
## 1.10.0 (May 18, 2011)
|
6
|
+
|
7
|
+
[Full Changelog](http://github.com/myronmarston/vcr/compare/v1.9.0...v1.10.0)
|
8
|
+
|
9
|
+
* Fix header normalization so that it properly handles nested arrays and
|
10
|
+
non-string values.
|
11
|
+
* Add cucumber scenario documenting how VCR sanitizes cassette names
|
12
|
+
to "normal" file names (i.e. only alphanumerics, no spaces).
|
13
|
+
* Add `:ignore_cassettes` option to `VCR.turn_off!`. This causes
|
14
|
+
cassette insertions to be ignored rather than to trigger an error.
|
15
|
+
Patch provided by [Justin Smestad](https://github.com/jsmestad).
|
16
|
+
* Fix rack middleware to make it threadsafe.
|
17
|
+
* Update to latest RSpec (rspec 2.6).
|
4
18
|
|
5
19
|
## 1.9.0 (April 14, 2011)
|
6
20
|
|
data/README.md
CHANGED
@@ -4,28 +4,30 @@ Record your test suite's HTTP interactions and replay them during future test ru
|
|
4
4
|
|
5
5
|
## Synopsis
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
7
|
+
``` ruby
|
8
|
+
require 'rubygems'
|
9
|
+
require 'test/unit'
|
10
|
+
require 'vcr'
|
11
|
+
|
12
|
+
VCR.config do |c|
|
13
|
+
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
14
|
+
c.stub_with :webmock # or :fakeweb
|
15
|
+
end
|
16
|
+
|
17
|
+
class VCRTest < Test::Unit::TestCase
|
18
|
+
def test_example_dot_com
|
19
|
+
VCR.use_cassette('synopsis') do
|
20
|
+
response = Net::HTTP.get_response(URI('http://www.iana.org/domains/example/'))
|
21
|
+
assert_match /Example Domains/, response.body
|
23
22
|
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
```
|
24
26
|
|
25
27
|
Run this test once, and VCR will record the http request to `fixtures/vcr_cassettes/synopsis.yml`. Run it again, and VCR
|
26
|
-
will replay the response from
|
27
|
-
made anymore), deterministic (the test will continue to pass, even if you are offline, or
|
28
|
-
maintenance) and accurate (the response
|
28
|
+
will replay the response from iana.org when the http request is made. This test is now fast (no real HTTP requests are
|
29
|
+
made anymore), deterministic (the test will continue to pass, even if you are offline, or iana.org goes down for
|
30
|
+
maintenance) and accurate (the response will contain the same headers and body you get from a real request).
|
29
31
|
|
30
32
|
## Features
|
31
33
|
|
@@ -39,7 +41,7 @@ maintenance) and accurate (the response from example.com will contain the same h
|
|
39
41
|
* [Excon](https://github.com/geemus/excon)
|
40
42
|
* Supports multiple HTTP libraries:
|
41
43
|
* [Patron](http://github.com/toland/patron) (when using WebMock)
|
42
|
-
* [Curb](http://github.com/taf2/curb) (when using WebMock -- only supports
|
44
|
+
* [Curb](http://github.com/taf2/curb) (when using WebMock -- only supports Curl::Easy at the moment)
|
43
45
|
* [HTTPClient](http://github.com/nahi/httpclient) (when using WebMock)
|
44
46
|
* [em-http-request](http://github.com/igrigorik/em-http-request) (when using WebMock)
|
45
47
|
* [Net::HTTP](http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html) (when using FakeWeb and WebMock)
|
@@ -136,6 +138,7 @@ Thanks also to the following people who have contributed patches or helpful sugg
|
|
136
138
|
* [Bartosz Blimke](http://github.com/bblimke)
|
137
139
|
* [Ben Hutton](http://github.com/benhutton)
|
138
140
|
* [Eric Allam](http://github.com/rubymaverick)
|
141
|
+
* [Justin Smestad](https://github.com/jsmestad)
|
139
142
|
* [Karl Baum](https://github.com/kbaum)
|
140
143
|
* [Nathaniel Bibler](https://github.com/nbibler)
|
141
144
|
* [Oliver Searle-Barnes](https://github.com/opsb)
|
data/features/.nav
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Naming
|
2
|
+
|
3
|
+
When inserting or using a cassette, the first argument is the cassette name.
|
4
|
+
You can use any string for the name. VCR will sanitize the string before
|
5
|
+
using it as a file name, so that it is a file-system friendly file name.
|
6
|
+
|
7
|
+
Scenario: Name sanitizing
|
8
|
+
Given a file named "name_sanitizing.rb" with:
|
9
|
+
"""
|
10
|
+
require 'vcr_cucumber_helpers'
|
11
|
+
|
12
|
+
start_sinatra_app(:port => 7777) do
|
13
|
+
get('/') { "Hello" }
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'vcr'
|
17
|
+
|
18
|
+
VCR.config do |c|
|
19
|
+
c.cassette_library_dir = 'cassettes'
|
20
|
+
c.stub_with :fakeweb
|
21
|
+
end
|
22
|
+
|
23
|
+
VCR.use_cassette('Fee, Fi Fo Fum', :record => :new_episodes) do
|
24
|
+
Net::HTTP.get_response('localhost', '/', 7777)
|
25
|
+
end
|
26
|
+
"""
|
27
|
+
And the directory "cassettes" does not exist
|
28
|
+
When I run "ruby name_sanitizing.rb"
|
29
|
+
Then the file "cassettes/Fee_Fi_Fo_Fum.yml" should contain "body: Hello"
|
@@ -11,7 +11,10 @@ Feature: Error for HTTP request made when no cassette is in use
|
|
11
11
|
(see configuration/allow_http_connections_when_no_cassette.feature) or
|
12
12
|
you can temporarily turn VCR off:
|
13
13
|
|
14
|
-
- `VCR.turn_off!` => turn VCR off so HTTP requests are allowed
|
14
|
+
- `VCR.turn_off!` => turn VCR off so HTTP requests are allowed.
|
15
|
+
Cassette insertions will trigger an error.
|
16
|
+
- `VCR.turn_off!(:ignore_cassettes => true)` => turn
|
17
|
+
VCR off and ignore cassette insertions (so that no error is raised).
|
15
18
|
- `VCR.turn_on!` => turn VCR back on
|
16
19
|
- `VCR.turned_off { ... }` => turn VCR off for the duration of the
|
17
20
|
provided block.
|
@@ -104,3 +107,45 @@ Feature: Error for HTTP request made when no cassette is in use
|
|
104
107
|
Error: Real HTTP connections are disabled.
|
105
108
|
"""
|
106
109
|
|
110
|
+
Scenario: Turning VCR off prevents cassettes from being inserted
|
111
|
+
Given a file named "turn_off_vcr_and_insert_cassette.rb" with:
|
112
|
+
"""
|
113
|
+
require 'vcr'
|
114
|
+
|
115
|
+
VCR.config do |c|
|
116
|
+
c.stub_with :fakeweb
|
117
|
+
end
|
118
|
+
|
119
|
+
VCR.turn_off!
|
120
|
+
VCR.insert_cassette('example')
|
121
|
+
"""
|
122
|
+
When I run "ruby turn_off_vcr_and_insert_cassette.rb"
|
123
|
+
Then it should fail with "VCR is turned off. You must turn it on before you can insert a cassette."
|
124
|
+
|
125
|
+
Scenario: Turning VCR off with `:ignore_cassettes => true` ignores cassettes
|
126
|
+
Given a file named "turn_off_vcr_and_insert_cassette.rb" with:
|
127
|
+
"""
|
128
|
+
require 'vcr_cucumber_helpers'
|
129
|
+
|
130
|
+
start_sinatra_app(:port => 7777) do
|
131
|
+
get('/') { 'Hello' }
|
132
|
+
end
|
133
|
+
|
134
|
+
require 'vcr'
|
135
|
+
|
136
|
+
VCR.config do |c|
|
137
|
+
c.cassette_library_dir = 'cassettes'
|
138
|
+
c.stub_with :fakeweb
|
139
|
+
end
|
140
|
+
|
141
|
+
VCR.turn_off!(:ignore_cassettes => true)
|
142
|
+
|
143
|
+
VCR.use_cassette('example') do
|
144
|
+
response = Net::HTTP.get_response('localhost', '/', 7777).body
|
145
|
+
puts "Response: #{response}"
|
146
|
+
end
|
147
|
+
"""
|
148
|
+
When I run "ruby turn_off_vcr_and_insert_cassette.rb"
|
149
|
+
Then it should pass with "Response: Hello"
|
150
|
+
And the file "cassettes/example.yml" should not exist
|
151
|
+
|
@@ -9,7 +9,7 @@ Feature: stub_with
|
|
9
9
|
- Net::HTTP
|
10
10
|
- HTTPClient
|
11
11
|
- Patron
|
12
|
-
- Curb (
|
12
|
+
- Curb (Curl::Easy, but not Curl::Multi)
|
13
13
|
- EM HTTP Request
|
14
14
|
- Typhoeus can be used to stub itself (as long as you use Typhoeus::Hydra,
|
15
15
|
but not Typhoeus::Easy or Typhoeus::Multi).
|
@@ -22,16 +22,20 @@ Feature: Usage with Cucumber
|
|
22
22
|
last argument to `#tag` or `#tags`.
|
23
23
|
|
24
24
|
Scenario: Record HTTP interactions in a scenario by tagging it
|
25
|
-
Given a file named "
|
25
|
+
Given a file named "lib/server.rb" with:
|
26
26
|
"""
|
27
|
-
require 'vcr_cucumber_helpers
|
27
|
+
require 'vcr_cucumber_helpers'
|
28
28
|
|
29
29
|
if ENV['WITH_SERVER'] == 'true'
|
30
30
|
start_sinatra_app(:port => 7777) do
|
31
31
|
get('/:path') { "Hello #{params[:path]}" }
|
32
32
|
end
|
33
33
|
end
|
34
|
+
"""
|
34
35
|
|
36
|
+
Given a file named "features/support/vcr.rb" with:
|
37
|
+
"""
|
38
|
+
require "lib/server"
|
35
39
|
require 'vcr'
|
36
40
|
|
37
41
|
VCR.config do |c|
|
data/lib/vcr.rb
CHANGED
@@ -48,17 +48,19 @@ module VCR
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def insert_cassette(name, options = {})
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
if turned_on?
|
52
|
+
if cassettes.any? { |c| c.name == name }
|
53
|
+
raise ArgumentError.new("There is already a cassette with the same name (#{name}). You cannot nest multiple cassettes with the same name.")
|
54
|
+
end
|
54
55
|
|
55
|
-
|
56
|
-
|
56
|
+
cassette = Cassette.new(name, options)
|
57
|
+
cassettes.push(cassette)
|
58
|
+
cassette
|
59
|
+
elsif !ignore_cassettes?
|
60
|
+
message = "VCR is turned off. You must turn it on before you can insert a cassette. " +
|
61
|
+
"Or you can use the `:ignore_cassette => true` option to completely ignore cassette insertions."
|
62
|
+
raise TurnedOffError.new(message)
|
57
63
|
end
|
58
|
-
|
59
|
-
cassette = Cassette.new(name, options)
|
60
|
-
cassettes.push(cassette)
|
61
|
-
cassette
|
62
64
|
end
|
63
65
|
|
64
66
|
def eject_cassette
|
@@ -108,8 +110,8 @@ module VCR
|
|
108
110
|
cassette.record_http_interaction(interaction)
|
109
111
|
end
|
110
112
|
|
111
|
-
def turned_off
|
112
|
-
turn_off!
|
113
|
+
def turned_off(options = {})
|
114
|
+
turn_off!(options)
|
113
115
|
|
114
116
|
begin
|
115
117
|
yield
|
@@ -118,11 +120,17 @@ module VCR
|
|
118
120
|
end
|
119
121
|
end
|
120
122
|
|
121
|
-
def turn_off!
|
123
|
+
def turn_off!(options = {})
|
122
124
|
if VCR.current_cassette
|
123
125
|
raise CassetteInUseError.new("A VCR cassette is currently in use. You must eject it before you can turn VCR off.")
|
124
126
|
end
|
125
127
|
|
128
|
+
@ignore_cassettes = options[:ignore_cassettes]
|
129
|
+
invalid_options = options.keys - [:ignore_cassettes]
|
130
|
+
if invalid_options.any?
|
131
|
+
raise ArgumentError.new("You passed some invalid options: #{invalid_options.inspect}")
|
132
|
+
end
|
133
|
+
|
126
134
|
VCR.http_stubbing_adapter.http_connections_allowed = true
|
127
135
|
@turned_off = true
|
128
136
|
end
|
@@ -136,6 +144,10 @@ module VCR
|
|
136
144
|
!@turned_off
|
137
145
|
end
|
138
146
|
|
147
|
+
def ignore_cassettes?
|
148
|
+
@ignore_cassettes
|
149
|
+
end
|
150
|
+
|
139
151
|
private
|
140
152
|
|
141
153
|
def adapter_for(lib)
|
data/lib/vcr/middleware/rack.rb
CHANGED
@@ -3,9 +3,16 @@ module VCR
|
|
3
3
|
class Rack
|
4
4
|
include Common
|
5
5
|
|
6
|
+
def initialize(*args)
|
7
|
+
@mutex = Mutex.new
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
6
11
|
def call(env)
|
7
|
-
|
8
|
-
|
12
|
+
@mutex.synchronize do
|
13
|
+
VCR.use_cassette(*cassette_arguments(env)) do
|
14
|
+
@app.call(env)
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
11
18
|
end
|
@@ -39,18 +39,26 @@ module VCR
|
|
39
39
|
important_vals = important_header_values(k, val_array)
|
40
40
|
next unless important_vals.size > 0
|
41
41
|
|
42
|
-
|
43
|
-
# Apparently for Paperclip uploads to S3, headers
|
44
|
-
# get serialized with some extra stuff which leads
|
45
|
-
# to a seg fault. See this issue for more info:
|
46
|
-
# https://github.com/myronmarston/vcr/issues#issue/39
|
47
|
-
string_vals = important_vals.map { |v| String.new(v) }
|
48
|
-
|
49
|
-
new_headers[k] = string_vals
|
42
|
+
new_headers[k] = convert_to_raw_strings(important_vals)
|
50
43
|
end if headers
|
51
44
|
|
52
45
|
self.headers = new_headers.empty? ? nil : new_headers
|
53
46
|
end
|
47
|
+
|
48
|
+
def convert_to_raw_strings(array)
|
49
|
+
# Ensure the values are raw strings.
|
50
|
+
# Apparently for Paperclip uploads to S3, headers
|
51
|
+
# get serialized with some extra stuff which leads
|
52
|
+
# to a seg fault. See this issue for more info:
|
53
|
+
# https://github.com/myronmarston/vcr/issues#issue/39
|
54
|
+
array.map do |v|
|
55
|
+
case v
|
56
|
+
when String; String.new(v)
|
57
|
+
when Array; convert_to_raw_strings(v)
|
58
|
+
else v
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
54
62
|
end
|
55
63
|
end
|
56
64
|
end
|
data/lib/vcr/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -41,7 +41,8 @@ end
|
|
41
41
|
|
42
42
|
RSpec.configure do |config|
|
43
43
|
config.color_enabled = true
|
44
|
-
config.debug = (using_git && RUBY_INTERPRETER == :mri)
|
44
|
+
config.debug = (using_git && RUBY_INTERPRETER == :mri && RUBY_VERSION != '1.9.1')
|
45
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
45
46
|
|
46
47
|
tmp_dir = File.expand_path('../../tmp/cassette_library_dir', __FILE__)
|
47
48
|
config.before(:each) do
|
@@ -40,7 +40,8 @@ HTTP_LIBRARY_ADAPTERS['httpclient'] = Module.new do
|
|
40
40
|
def self.http_library_name; 'HTTP Client'; end
|
41
41
|
|
42
42
|
def get_body_string(response)
|
43
|
-
|
43
|
+
body = response.body
|
44
|
+
string = body.is_a?(String) ? body : body.content
|
44
45
|
string.respond_to?(:read) ? string.read : string
|
45
46
|
end
|
46
47
|
|
@@ -37,6 +37,18 @@ shared_examples_for "header normalization" do
|
|
37
37
|
instance = with_headers('my-key' => [value])
|
38
38
|
VCR::YAML.dump(instance.headers).should == VCR::YAML.dump('my-key' => ['my-value'])
|
39
39
|
end
|
40
|
+
|
41
|
+
it 'handles nested arrays' do
|
42
|
+
accept_encoding = [["gzip", "1.0"], ["deflate", "1.0"], ["sdch", "1.0"]]
|
43
|
+
instance = with_headers('accept-encoding' => accept_encoding)
|
44
|
+
instance.headers['accept-encoding'].should == accept_encoding
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'handles nested arrays with floats' do
|
48
|
+
accept_encoding = [["gzip", 1.0], ["deflate", 1.0], ["sdch", 1.0]]
|
49
|
+
instance = with_headers('accept-encoding' => accept_encoding)
|
50
|
+
instance.headers['accept-encoding'].should == accept_encoding
|
51
|
+
end
|
40
52
|
end
|
41
53
|
|
42
54
|
shared_examples_for "body normalization" do
|
data/spec/support/sinatra_app.rb
CHANGED
@@ -29,7 +29,13 @@ module VCR
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.server
|
32
|
-
|
32
|
+
raise "Sinatra app failed to boot." if @_boot_failed
|
33
|
+
@server ||= begin
|
34
|
+
VCR::LocalhostServer.new(new)
|
35
|
+
rescue
|
36
|
+
@_boot_failed = true
|
37
|
+
raise
|
38
|
+
end
|
33
39
|
end
|
34
40
|
end
|
35
41
|
end
|
@@ -13,7 +13,7 @@ module VCR
|
|
13
13
|
|
14
14
|
def call(env)
|
15
15
|
if env["PATH_INFO"] == "/__identify__"
|
16
|
-
[200, {}, @app.object_id.to_s]
|
16
|
+
[200, {}, [@app.object_id.to_s]]
|
17
17
|
else
|
18
18
|
@app.call(env)
|
19
19
|
end
|
@@ -40,7 +40,9 @@ module VCR
|
|
40
40
|
|
41
41
|
def boot
|
42
42
|
# Use WEBrick since it's part of the ruby standard library and is available on all ruby interpreters.
|
43
|
-
|
43
|
+
options = { :Port => port }
|
44
|
+
options.merge!(:AccessLog => [], :Logger => WEBrick::BasicLog.new(StringIO.new)) unless ENV['CI']
|
45
|
+
Rack::Handler::WEBrick.run(Identify.new(@rack_app), options)
|
44
46
|
end
|
45
47
|
|
46
48
|
def booted?
|
data/spec/vcr/cassette_spec.rb
CHANGED
@@ -449,7 +449,7 @@ describe VCR::Cassette do
|
|
449
449
|
end
|
450
450
|
|
451
451
|
it "matches old requests to new ones using the cassette's match attributes" do
|
452
|
-
pending("Need to fix this to work with Psych", :if => defined?(::Psych)) do
|
452
|
+
pending("Need to fix this to work with Psych", :if => defined?(::Psych) && !ENV['CI']) do
|
453
453
|
[
|
454
454
|
old_interaction_1, old_interaction_2, old_interaction_3,
|
455
455
|
new_interaction_1, new_interaction_2, new_interaction_3
|
@@ -51,4 +51,24 @@ describe VCR::Middleware::Rack do
|
|
51
51
|
instance.call(env_hash)
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
let(:threaded_app) do
|
56
|
+
lambda do |env|
|
57
|
+
sleep 0.15
|
58
|
+
VCR.send(:cassettes).should have(1).cassette
|
59
|
+
[200, {}, ['OK']]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'is thread safe' do
|
64
|
+
stack = described_class.new(threaded_app) do |cassette|
|
65
|
+
cassette.name 'c'
|
66
|
+
end
|
67
|
+
|
68
|
+
thread = Thread.new { stack.call({}) }
|
69
|
+
stack.call({})
|
70
|
+
thread.join
|
71
|
+
|
72
|
+
VCR.current_cassette.should be_nil
|
73
|
+
end
|
54
74
|
end
|
data/spec/vcr_spec.rb
CHANGED
@@ -237,6 +237,32 @@ describe VCR do
|
|
237
237
|
VCR.insert_cassette('foo')
|
238
238
|
}.to raise_error(VCR::TurnedOffError)
|
239
239
|
end
|
240
|
+
|
241
|
+
it 'raises an ArgumentError when given an invalid option' do
|
242
|
+
expect {
|
243
|
+
VCR.turn_off!(:invalid_option => true)
|
244
|
+
}.to raise_error(ArgumentError)
|
245
|
+
end
|
246
|
+
|
247
|
+
context 'when `:ignore_cassettes => true` is passed' do
|
248
|
+
before(:each) { VCR.turn_off!(:ignore_cassettes => true) }
|
249
|
+
|
250
|
+
it 'ignores cassette insertions' do
|
251
|
+
VCR.insert_cassette('foo')
|
252
|
+
VCR.current_cassette.should be_nil
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'still runs a block passed to use_cassette' do
|
256
|
+
yielded = false
|
257
|
+
|
258
|
+
VCR.use_cassette('foo') do
|
259
|
+
yielded = true
|
260
|
+
VCR.current_cassette.should be_nil
|
261
|
+
end
|
262
|
+
|
263
|
+
yielded.should be_true
|
264
|
+
end
|
265
|
+
end
|
240
266
|
end
|
241
267
|
|
242
268
|
describe '.turn_on!' do
|
@@ -267,6 +293,11 @@ describe VCR do
|
|
267
293
|
yielded.should == true
|
268
294
|
VCR.should be_turned_on
|
269
295
|
end
|
296
|
+
|
297
|
+
it 'passes options through to .turn_off!' do
|
298
|
+
VCR.should_receive(:turn_off!).with(:ignore_cassettes => true)
|
299
|
+
VCR.turned_off(:ignore_cassettes => true) { }
|
300
|
+
end
|
270
301
|
end
|
271
302
|
|
272
303
|
describe '.turned_on?' do
|
data/vcr.gemspec
CHANGED
@@ -21,13 +21,14 @@ Gem::Specification.new do |s|
|
|
21
21
|
'bundler' => '~> 1.0.7',
|
22
22
|
'rake' => '~> 0.8.7',
|
23
23
|
|
24
|
-
'rspec' => '~> 2.
|
24
|
+
'rspec' => '~> 2.6',
|
25
25
|
'cucumber' => '~> 0.9.4',
|
26
26
|
'aruba' => '0.2.4',
|
27
27
|
'shoulda' => '~> 2.9.2',
|
28
28
|
|
29
29
|
'fakeweb' => '~> 1.3.0',
|
30
|
-
'webmock' => '~> 1.6.
|
30
|
+
'webmock' => '~> 1.6.4',
|
31
|
+
'addressable' => '~> 2.2.6',
|
31
32
|
|
32
33
|
'faraday' => '~> 0.6.0',
|
33
34
|
'httpclient' => '~> 2.1.5.2',
|
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: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 10
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.10.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Myron Marston
|
@@ -15,14 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-05-19 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
21
|
type: :development
|
24
|
-
|
25
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
23
|
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
@@ -33,12 +30,12 @@ dependencies:
|
|
33
30
|
- 6
|
34
31
|
- 0
|
35
32
|
version: 0.6.0
|
36
|
-
|
37
|
-
|
33
|
+
version_requirements: *id001
|
34
|
+
name: faraday
|
38
35
|
prerelease: false
|
36
|
+
- !ruby/object:Gem::Dependency
|
39
37
|
type: :development
|
40
|
-
|
41
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
40
|
requirements:
|
44
41
|
- - ~>
|
@@ -49,12 +46,12 @@ dependencies:
|
|
49
46
|
- 3
|
50
47
|
- 0
|
51
48
|
version: 1.3.0
|
52
|
-
|
53
|
-
|
49
|
+
version_requirements: *id002
|
50
|
+
name: fakeweb
|
54
51
|
prerelease: false
|
52
|
+
- !ruby/object:Gem::Dependency
|
55
53
|
type: :development
|
56
|
-
|
57
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
55
|
none: false
|
59
56
|
requirements:
|
60
57
|
- - ~>
|
@@ -66,12 +63,12 @@ dependencies:
|
|
66
63
|
- 5
|
67
64
|
- 2
|
68
65
|
version: 2.1.5.2
|
69
|
-
|
70
|
-
|
66
|
+
version_requirements: *id003
|
67
|
+
name: httpclient
|
71
68
|
prerelease: false
|
69
|
+
- !ruby/object:Gem::Dependency
|
72
70
|
type: :development
|
73
|
-
|
74
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
73
|
requirements:
|
77
74
|
- - ~>
|
@@ -82,12 +79,12 @@ dependencies:
|
|
82
79
|
- 8
|
83
80
|
- 7
|
84
81
|
version: 0.8.7
|
85
|
-
|
86
|
-
|
82
|
+
version_requirements: *id004
|
83
|
+
name: rake
|
87
84
|
prerelease: false
|
85
|
+
- !ruby/object:Gem::Dependency
|
88
86
|
type: :development
|
89
|
-
|
90
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
87
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
91
88
|
none: false
|
92
89
|
requirements:
|
93
90
|
- - ~>
|
@@ -98,12 +95,28 @@ dependencies:
|
|
98
95
|
- 3
|
99
96
|
- 5
|
100
97
|
version: 0.3.5
|
101
|
-
|
98
|
+
version_requirements: *id005
|
99
|
+
name: timecop
|
100
|
+
prerelease: false
|
102
101
|
- !ruby/object:Gem::Dependency
|
102
|
+
type: :development
|
103
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ~>
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 11
|
109
|
+
segments:
|
110
|
+
- 2
|
111
|
+
- 2
|
112
|
+
- 6
|
113
|
+
version: 2.2.6
|
114
|
+
version_requirements: *id006
|
115
|
+
name: addressable
|
103
116
|
prerelease: false
|
117
|
+
- !ruby/object:Gem::Dependency
|
104
118
|
type: :development
|
105
|
-
|
106
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
119
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
107
120
|
none: false
|
108
121
|
requirements:
|
109
122
|
- - ~>
|
@@ -114,27 +127,27 @@ dependencies:
|
|
114
127
|
- 9
|
115
128
|
- 2
|
116
129
|
version: 2.9.2
|
117
|
-
|
118
|
-
|
130
|
+
version_requirements: *id007
|
131
|
+
name: shoulda
|
119
132
|
prerelease: false
|
133
|
+
- !ruby/object:Gem::Dependency
|
120
134
|
type: :development
|
121
|
-
|
122
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
135
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
123
136
|
none: false
|
124
137
|
requirements:
|
125
138
|
- - ~>
|
126
139
|
- !ruby/object:Gem::Version
|
127
|
-
hash:
|
140
|
+
hash: 15
|
128
141
|
segments:
|
129
142
|
- 2
|
130
|
-
-
|
131
|
-
version: "2.
|
132
|
-
|
133
|
-
|
143
|
+
- 6
|
144
|
+
version: "2.6"
|
145
|
+
version_requirements: *id008
|
146
|
+
name: rspec
|
134
147
|
prerelease: false
|
148
|
+
- !ruby/object:Gem::Dependency
|
135
149
|
type: :development
|
136
|
-
|
137
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
150
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
138
151
|
none: false
|
139
152
|
requirements:
|
140
153
|
- - "="
|
@@ -145,12 +158,12 @@ dependencies:
|
|
145
158
|
- 1
|
146
159
|
- 0
|
147
160
|
version: 1.1.0
|
148
|
-
|
149
|
-
|
161
|
+
version_requirements: *id009
|
162
|
+
name: rack
|
150
163
|
prerelease: false
|
164
|
+
- !ruby/object:Gem::Dependency
|
151
165
|
type: :development
|
152
|
-
|
153
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
166
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
154
167
|
none: false
|
155
168
|
requirements:
|
156
169
|
- - "="
|
@@ -161,12 +174,12 @@ dependencies:
|
|
161
174
|
- 2
|
162
175
|
- 4
|
163
176
|
version: 0.2.4
|
164
|
-
|
165
|
-
|
177
|
+
version_requirements: *id010
|
178
|
+
name: aruba
|
166
179
|
prerelease: false
|
180
|
+
- !ruby/object:Gem::Dependency
|
167
181
|
type: :development
|
168
|
-
|
169
|
-
version_requirements: &id010 !ruby/object:Gem::Requirement
|
182
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
170
183
|
none: false
|
171
184
|
requirements:
|
172
185
|
- - ~>
|
@@ -177,12 +190,12 @@ dependencies:
|
|
177
190
|
- 1
|
178
191
|
- 0
|
179
192
|
version: 1.1.0
|
180
|
-
|
181
|
-
|
193
|
+
version_requirements: *id011
|
194
|
+
name: sinatra
|
182
195
|
prerelease: false
|
196
|
+
- !ruby/object:Gem::Dependency
|
183
197
|
type: :development
|
184
|
-
|
185
|
-
version_requirements: &id011 !ruby/object:Gem::Requirement
|
198
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
186
199
|
none: false
|
187
200
|
requirements:
|
188
201
|
- - ~>
|
@@ -193,12 +206,12 @@ dependencies:
|
|
193
206
|
- 0
|
194
207
|
- 7
|
195
208
|
version: 1.0.7
|
196
|
-
|
197
|
-
|
209
|
+
version_requirements: *id012
|
210
|
+
name: bundler
|
198
211
|
prerelease: false
|
212
|
+
- !ruby/object:Gem::Dependency
|
199
213
|
type: :development
|
200
|
-
|
201
|
-
version_requirements: &id012 !ruby/object:Gem::Requirement
|
214
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
202
215
|
none: false
|
203
216
|
requirements:
|
204
217
|
- - ~>
|
@@ -209,12 +222,12 @@ dependencies:
|
|
209
222
|
- 6
|
210
223
|
- 2
|
211
224
|
version: 0.6.2
|
212
|
-
|
213
|
-
|
225
|
+
version_requirements: *id013
|
226
|
+
name: excon
|
214
227
|
prerelease: false
|
228
|
+
- !ruby/object:Gem::Dependency
|
215
229
|
type: :development
|
216
|
-
|
217
|
-
version_requirements: &id013 !ruby/object:Gem::Requirement
|
230
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
218
231
|
none: false
|
219
232
|
requirements:
|
220
233
|
- - ~>
|
@@ -225,28 +238,28 @@ dependencies:
|
|
225
238
|
- 9
|
226
239
|
- 4
|
227
240
|
version: 0.9.4
|
228
|
-
|
229
|
-
|
241
|
+
version_requirements: *id014
|
242
|
+
name: cucumber
|
230
243
|
prerelease: false
|
244
|
+
- !ruby/object:Gem::Dependency
|
231
245
|
type: :development
|
232
|
-
|
233
|
-
version_requirements: &id014 !ruby/object:Gem::Requirement
|
246
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
234
247
|
none: false
|
235
248
|
requirements:
|
236
249
|
- - ~>
|
237
250
|
- !ruby/object:Gem::Version
|
238
|
-
hash:
|
251
|
+
hash: 7
|
239
252
|
segments:
|
240
253
|
- 1
|
241
254
|
- 6
|
242
|
-
-
|
243
|
-
version: 1.6.
|
244
|
-
|
245
|
-
|
255
|
+
- 4
|
256
|
+
version: 1.6.4
|
257
|
+
version_requirements: *id015
|
258
|
+
name: webmock
|
246
259
|
prerelease: false
|
260
|
+
- !ruby/object:Gem::Dependency
|
247
261
|
type: :development
|
248
|
-
|
249
|
-
version_requirements: &id015 !ruby/object:Gem::Requirement
|
262
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
250
263
|
none: false
|
251
264
|
requirements:
|
252
265
|
- - "="
|
@@ -257,12 +270,12 @@ dependencies:
|
|
257
270
|
- 7
|
258
271
|
- 8
|
259
272
|
version: 0.7.8
|
260
|
-
|
261
|
-
|
273
|
+
version_requirements: *id016
|
274
|
+
name: curb
|
262
275
|
prerelease: false
|
276
|
+
- !ruby/object:Gem::Dependency
|
263
277
|
type: :development
|
264
|
-
|
265
|
-
version_requirements: &id016 !ruby/object:Gem::Requirement
|
278
|
+
requirement: &id017 !ruby/object:Gem::Requirement
|
266
279
|
none: false
|
267
280
|
requirements:
|
268
281
|
- - "="
|
@@ -273,12 +286,12 @@ dependencies:
|
|
273
286
|
- 4
|
274
287
|
- 9
|
275
288
|
version: 0.4.9
|
276
|
-
|
277
|
-
|
289
|
+
version_requirements: *id017
|
290
|
+
name: patron
|
278
291
|
prerelease: false
|
292
|
+
- !ruby/object:Gem::Dependency
|
279
293
|
type: :development
|
280
|
-
|
281
|
-
version_requirements: &id017 !ruby/object:Gem::Requirement
|
294
|
+
requirement: &id018 !ruby/object:Gem::Requirement
|
282
295
|
none: false
|
283
296
|
requirements:
|
284
297
|
- - ~>
|
@@ -289,12 +302,12 @@ dependencies:
|
|
289
302
|
- 3
|
290
303
|
- 0
|
291
304
|
version: 0.3.0
|
292
|
-
|
293
|
-
|
305
|
+
version_requirements: *id018
|
306
|
+
name: em-http-request
|
294
307
|
prerelease: false
|
308
|
+
- !ruby/object:Gem::Dependency
|
295
309
|
type: :development
|
296
|
-
|
297
|
-
version_requirements: &id018 !ruby/object:Gem::Requirement
|
310
|
+
requirement: &id019 !ruby/object:Gem::Requirement
|
298
311
|
none: false
|
299
312
|
requirements:
|
300
313
|
- - ~>
|
@@ -305,7 +318,9 @@ dependencies:
|
|
305
318
|
- 2
|
306
319
|
- 1
|
307
320
|
version: 0.2.1
|
308
|
-
|
321
|
+
version_requirements: *id019
|
322
|
+
name: typhoeus
|
323
|
+
prerelease: false
|
309
324
|
description: VCR provides a simple API to record and replay your test suite's HTTP interactions. It works with a variety of HTTP client libraries, HTTP stubbing libraries and testing frameworks.
|
310
325
|
email: myron.marston@gmail.com
|
311
326
|
executables: []
|
@@ -334,6 +349,7 @@ files:
|
|
334
349
|
- features/cassettes/automatic_re_recording.feature
|
335
350
|
- features/cassettes/dynamic_erb.feature
|
336
351
|
- features/cassettes/format.feature
|
352
|
+
- features/cassettes/naming.feature
|
337
353
|
- features/cassettes/no_cassette.feature
|
338
354
|
- features/cassettes/request_matching.feature
|
339
355
|
- features/cassettes/update_content_length_header.feature
|
@@ -468,7 +484,6 @@ files:
|
|
468
484
|
- spec/vcr/version_spec.rb
|
469
485
|
- spec/vcr_spec.rb
|
470
486
|
- vcr.gemspec
|
471
|
-
has_rdoc: true
|
472
487
|
homepage: http://github.com/myronmarston/vcr
|
473
488
|
licenses: []
|
474
489
|
|
@@ -502,7 +517,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
502
517
|
requirements: []
|
503
518
|
|
504
519
|
rubyforge_project:
|
505
|
-
rubygems_version: 1.
|
520
|
+
rubygems_version: 1.8.2
|
506
521
|
signing_key:
|
507
522
|
specification_version: 3
|
508
523
|
summary: Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
|
@@ -511,6 +526,7 @@ test_files:
|
|
511
526
|
- features/cassettes/automatic_re_recording.feature
|
512
527
|
- features/cassettes/dynamic_erb.feature
|
513
528
|
- features/cassettes/format.feature
|
529
|
+
- features/cassettes/naming.feature
|
514
530
|
- features/cassettes/no_cassette.feature
|
515
531
|
- features/cassettes/request_matching.feature
|
516
532
|
- features/cassettes/update_content_length_header.feature
|