vcr 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -2
- data/Gemfile +3 -0
- data/Gemfile.lock +20 -2
- data/README.md +6 -1
- data/Rakefile +6 -44
- data/benchmarks/http_stubbing_libraries.rb +4 -4
- data/cucumber.yml +14 -0
- data/features/README.md +21 -0
- data/features/cassettes/automatic_re_recording.feature +68 -0
- data/features/cassettes/dynamic_erb.feature +90 -0
- data/features/cassettes/format.feature +81 -0
- data/features/cassettes/no_cassette.feature +38 -0
- data/features/cassettes/record_modes/all.feature +78 -0
- data/features/cassettes/record_modes/new_episodes.feature +71 -0
- data/features/cassettes/record_modes/none.feature +65 -0
- data/features/cassettes/request_matching.feature +379 -0
- data/features/configuration/cassette_library_dir.feature +28 -0
- data/features/configuration/default_cassette_options.feature +80 -0
- data/features/configuration/ignore_localhost.feature +103 -0
- data/features/configuration/stub_with.feature +164 -0
- data/features/http_libraries/net_http.feature +137 -0
- data/features/step_definitions/cli_steps.rb +82 -0
- data/features/support/aruba_workaround/aruba_patches.rb +36 -0
- data/features/support/aruba_workaround/background_process.rb +4 -0
- data/features/support/env.rb +16 -102
- data/features/support/http_lib_filters.rb +37 -0
- data/features/support/vcr_cucumber_helpers.rb +34 -0
- data/features/test_frameworks/cucumber.feature +109 -0
- data/features/test_frameworks/rspec.feature +110 -0
- data/features/test_frameworks/shoulda.feature +64 -0
- data/features/test_frameworks/test_unit.feature +46 -0
- data/lib/vcr/cassette.rb +1 -1
- data/lib/vcr/structs.rb +64 -13
- data/lib/vcr/version.rb +1 -1
- data/{FullBuildRakeFile → script/FullBuildRakeFile} +0 -0
- data/script/full_build +1 -0
- data/spec/extensions/net_http_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/structs_spec.rb +47 -16
- data/spec/support/vcr_localhost_server.rb +11 -5
- data/vcr.gemspec +2 -1
- metadata +82 -77
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/regex_cassette.yml +0 -43
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette1.yml +0 -43
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette2.yml +0 -63
- data/features/fixtures/vcr_cassettes/1.9.1/cucumber_tags/replay_cassette3.yml +0 -85
- data/features/fixtures/vcr_cassettes/1.9.1/erb_cassette.yml +0 -36
- data/features/fixtures/vcr_cassettes/1.9.1/match_requests_on.yml +0 -35
- data/features/fixtures/vcr_cassettes/1.9.1/nested_replay_cassette.yml +0 -32
- data/features/fixtures/vcr_cassettes/1.9.1/not_the_real_response.yml +0 -43
- data/features/fixtures/vcr_cassettes/1.9.1/record_all.yml +0 -62
- data/features/fixtures/vcr_cassettes/1.9.1/replay_localhost_cassette.yml +0 -32
- data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/regex_cassette.yml +0 -43
- data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/replay_cassette1.yml +0 -43
- data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/replay_cassette2.yml +0 -47
- data/features/fixtures/vcr_cassettes/not_1.9.1/cucumber_tags/replay_cassette3.yml +0 -85
- data/features/fixtures/vcr_cassettes/not_1.9.1/erb_cassette.yml +0 -36
- data/features/fixtures/vcr_cassettes/not_1.9.1/match_requests_on.yml +0 -35
- data/features/fixtures/vcr_cassettes/not_1.9.1/nested_replay_cassette.yml +0 -24
- data/features/fixtures/vcr_cassettes/not_1.9.1/not_the_real_response.yml +0 -43
- data/features/fixtures/vcr_cassettes/not_1.9.1/record_all.yml +0 -61
- data/features/fixtures/vcr_cassettes/not_1.9.1/replay_localhost_cassette.yml +0 -32
- data/features/http_client.feature +0 -16
- data/features/net_http.feature +0 -38
- data/features/record_response.feature +0 -95
- data/features/replay_recorded_response.feature +0 -96
- data/features/rspec.feature +0 -100
- data/features/step_definitions/http_client_steps.rb +0 -7
- data/features/step_definitions/net_http_steps.rb +0 -49
- data/features/step_definitions/vcr_steps.rb +0 -252
- data/features/webmock.feature +0 -26
- data/full_build +0 -1
@@ -0,0 +1,64 @@
|
|
1
|
+
Feature: Usage with shoulda
|
2
|
+
|
3
|
+
When using a test framework that provides setup and teardown hooks
|
4
|
+
(such as shoulda), you can use `VCR.insert_cassette` and
|
5
|
+
`VCR.eject_cassette` to use a cassette for some tests.
|
6
|
+
|
7
|
+
The first argument to `VCR.insert_cassette` should be the cassette
|
8
|
+
name; you can follow that with a hash of cassette options.
|
9
|
+
|
10
|
+
Note that you _must_ eject every cassette you insert; if you use
|
11
|
+
`VCR.insert_cassette` rather than wrapping code in `VCR.use_cassette`,
|
12
|
+
then it is your responsibility to ensure it is ejected, even if
|
13
|
+
errors occur.
|
14
|
+
|
15
|
+
Scenario: Use `VCR.insert_cassette` and `VCR.eject_cassette`
|
16
|
+
Given a file named "test/test_helper.rb" with:
|
17
|
+
"""
|
18
|
+
require 'test/unit'
|
19
|
+
require 'shoulda'
|
20
|
+
require 'vcr_cucumber_helpers'
|
21
|
+
|
22
|
+
if ARGV.include?('--with-server')
|
23
|
+
start_sinatra_app(:port => 7777) do
|
24
|
+
get('/') { "Hello" }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
require 'vcr'
|
29
|
+
|
30
|
+
VCR.config do |c|
|
31
|
+
c.stub_with :webmock
|
32
|
+
c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
|
33
|
+
c.default_cassette_options = { :record => :new_episodes }
|
34
|
+
end
|
35
|
+
"""
|
36
|
+
And a file named "test/vcr_example_test.rb" with:
|
37
|
+
"""
|
38
|
+
require 'test_helper'
|
39
|
+
|
40
|
+
class VCRExampleTest < Test::Unit::TestCase
|
41
|
+
context 'using a VCR cassette' do
|
42
|
+
setup do
|
43
|
+
VCR.insert_cassette('shoulda_example')
|
44
|
+
end
|
45
|
+
|
46
|
+
should 'make an HTTP request' do
|
47
|
+
response = Net::HTTP.get_response('localhost', '/', 7777)
|
48
|
+
assert_equal "Hello", response.body
|
49
|
+
end
|
50
|
+
|
51
|
+
teardown do
|
52
|
+
VCR.eject_cassette
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
"""
|
57
|
+
And the directory "test/fixtures/vcr_cassettes" does not exist
|
58
|
+
When I run "ruby -Itest test/vcr_example_test.rb -- --with-server"
|
59
|
+
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
60
|
+
And the file "test/fixtures/vcr_cassettes/shoulda_example.yml" should contain "body: Hello"
|
61
|
+
|
62
|
+
# Run again without starting the sinatra server so the response will be replayed
|
63
|
+
When I run "ruby -Itest test/vcr_example_test.rb"
|
64
|
+
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Usage with Test::Unit
|
2
|
+
|
3
|
+
To use VCR with Test::Unit, wrap the body of any test method in
|
4
|
+
`VCR.use_cassette`.
|
5
|
+
|
6
|
+
Scenario: Use `VCR.use_cassette` in a test
|
7
|
+
Given a file named "test/test_helper.rb" with:
|
8
|
+
"""
|
9
|
+
require 'test/unit'
|
10
|
+
require 'vcr_cucumber_helpers'
|
11
|
+
|
12
|
+
if ARGV.include?('--with-server')
|
13
|
+
start_sinatra_app(:port => 7777) do
|
14
|
+
get('/') { "Hello" }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'vcr'
|
19
|
+
|
20
|
+
VCR.config do |c|
|
21
|
+
c.stub_with :webmock
|
22
|
+
c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
|
23
|
+
c.default_cassette_options = { :record => :new_episodes }
|
24
|
+
end
|
25
|
+
"""
|
26
|
+
And a file named "test/vcr_example_test.rb" with:
|
27
|
+
"""
|
28
|
+
require 'test_helper'
|
29
|
+
|
30
|
+
class VCRExampleTest < Test::Unit::TestCase
|
31
|
+
def test_use_vcr
|
32
|
+
VCR.use_cassette('test_unit_example') do
|
33
|
+
response = Net::HTTP.get_response('localhost', '/', 7777)
|
34
|
+
assert_equal "Hello", response.body
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
"""
|
39
|
+
And the directory "test/fixtures/vcr_cassettes" does not exist
|
40
|
+
When I run "ruby -Itest test/vcr_example_test.rb -- --with-server"
|
41
|
+
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
42
|
+
And the file "test/fixtures/vcr_cassettes/test_unit_example.yml" should contain "body: Hello"
|
43
|
+
|
44
|
+
# Run again without starting the sinatra server so the response will be replayed
|
45
|
+
When I run "ruby -Itest test/vcr_example_test.rb"
|
46
|
+
Then it should pass with "1 tests, 1 assertions, 0 failures, 0 errors"
|
data/lib/vcr/cassette.rb
CHANGED
@@ -9,7 +9,7 @@ module VCR
|
|
9
9
|
|
10
10
|
VALID_RECORD_MODES = [:all, :none, :new_episodes].freeze
|
11
11
|
|
12
|
-
attr_reader :name, :record_mode, :match_requests_on
|
12
|
+
attr_reader :name, :record_mode, :match_requests_on, :erb, :re_record_interval
|
13
13
|
|
14
14
|
def initialize(name, options = {})
|
15
15
|
options = VCR::Config.default_cassette_options.merge(options)
|
data/lib/vcr/structs.rb
CHANGED
@@ -1,7 +1,39 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
|
3
3
|
module VCR
|
4
|
+
module BodyNormalizer
|
5
|
+
def initialize(*args)
|
6
|
+
super
|
7
|
+
normalize_body
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def normalize_body
|
13
|
+
# Ensure that the body is a raw string, in case the string instance
|
14
|
+
# has been subclassed or extended with additional instance variables
|
15
|
+
# or attributes, so that it is serialized to YAML as a raw string.
|
16
|
+
# This is needed for rest-client. See this ticket for more info:
|
17
|
+
# http://github.com/myronmarston/vcr/issues/4
|
18
|
+
self.body = case body
|
19
|
+
when nil, ''; nil
|
20
|
+
else String.new(body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
4
25
|
module HeaderNormalizer
|
26
|
+
# These headers get added by the various HTTP clients automatically,
|
27
|
+
# and we don't care about them. We store the headers for the purposes
|
28
|
+
# of request matching, and we only care to match on headers users
|
29
|
+
# explicitly set.
|
30
|
+
HEADERS_TO_SKIP = {
|
31
|
+
'connection' => %w[ close Keep-Alive ],
|
32
|
+
'accept' => %w[ */* ],
|
33
|
+
'expect' => [''],
|
34
|
+
'user-agent' => ["Typhoeus - http://github.com/pauldix/typhoeus/tree/master", 'Ruby']
|
35
|
+
}
|
36
|
+
|
5
37
|
def initialize(*args)
|
6
38
|
super
|
7
39
|
normalize_headers
|
@@ -9,18 +41,30 @@ module VCR
|
|
9
41
|
|
10
42
|
private
|
11
43
|
|
44
|
+
def important_header_values(k, values)
|
45
|
+
skip_values = HEADERS_TO_SKIP[k] || []
|
46
|
+
values - skip_values
|
47
|
+
end
|
48
|
+
|
12
49
|
def normalize_headers
|
13
50
|
new_headers = {}
|
14
51
|
|
15
52
|
headers.each do |k, v|
|
16
|
-
|
53
|
+
k = k.downcase
|
54
|
+
|
55
|
+
val_array = case v
|
17
56
|
when Array then v
|
18
57
|
when nil then []
|
19
58
|
else [v]
|
20
59
|
end
|
60
|
+
|
61
|
+
important_vals = important_header_values(k, val_array)
|
62
|
+
next unless important_vals.size > 0
|
63
|
+
|
64
|
+
new_headers[k] = important_vals
|
21
65
|
end if headers
|
22
66
|
|
23
|
-
self.headers = new_headers
|
67
|
+
self.headers = new_headers.empty? ? nil : new_headers
|
24
68
|
end
|
25
69
|
end
|
26
70
|
|
@@ -55,9 +99,24 @@ module VCR
|
|
55
99
|
end
|
56
100
|
end
|
57
101
|
|
102
|
+
module StatusMessageNormalizer
|
103
|
+
def initialize(*args)
|
104
|
+
super
|
105
|
+
normalize_status_message
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def normalize_status_message
|
111
|
+
self.message = message.strip if message
|
112
|
+
self.message = nil if message == ''
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
58
116
|
class Request < Struct.new(:method, :uri, :body, :headers)
|
59
117
|
include HeaderNormalizer
|
60
118
|
include URINormalizer
|
119
|
+
include BodyNormalizer
|
61
120
|
|
62
121
|
def self.from_net_http_request(net_http, request)
|
63
122
|
new(
|
@@ -74,6 +133,8 @@ module VCR
|
|
74
133
|
end
|
75
134
|
|
76
135
|
class ResponseStatus < Struct.new(:code, :message)
|
136
|
+
include StatusMessageNormalizer
|
137
|
+
|
77
138
|
def self.from_net_http_response(response)
|
78
139
|
new(response.code.to_i, response.message)
|
79
140
|
end
|
@@ -81,17 +142,7 @@ module VCR
|
|
81
142
|
|
82
143
|
class Response < Struct.new(:status, :headers, :body, :http_version)
|
83
144
|
include HeaderNormalizer
|
84
|
-
|
85
|
-
def initialize(*args)
|
86
|
-
super
|
87
|
-
|
88
|
-
# Ensure that the body is a raw string, in case the string instance
|
89
|
-
# has been subclassed or extended with additional instance variables
|
90
|
-
# or attributes, so that it is serialized to YAML as a raw string.
|
91
|
-
# This is needed for rest-client. See this ticket for more info:
|
92
|
-
# http://github.com/myronmarston/vcr/issues/4
|
93
|
-
self.body = String.new(body) if body
|
94
|
-
end
|
145
|
+
include BodyNormalizer
|
95
146
|
|
96
147
|
def self.from_net_http_response(response)
|
97
148
|
new(
|
data/lib/vcr/version.rb
CHANGED
File without changes
|
data/script/full_build
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.8.6,1.8.7,1.9.1,1.9.2,ree,jruby,rbx-head rake -f script/FullBuildRakeFile build | tee tmp/full_build.out
|
@@ -43,7 +43,7 @@ describe "Net::HTTP Extensions" do
|
|
43
43
|
interaction.request.headers.should_not have_key('content-type')
|
44
44
|
interaction.request.headers.should_not have_key('host')
|
45
45
|
end
|
46
|
-
Net::HTTP.new('example.com', 80).send_request('POST', '/', '', {})
|
46
|
+
Net::HTTP.new('example.com', 80).send_request('POST', '/', '', { 'x-http-user' => 'me' })
|
47
47
|
end
|
48
48
|
|
49
49
|
it "records headers for which Net::HTTP usually sets defaults when the user manually sets their values" do
|
data/spec/spec_helper.rb
CHANGED
@@ -9,7 +9,7 @@ YAML_SERIALIZATION_VERSION = RUBY_VERSION == '1.9.1' ? '1.9.1' : 'not_1.9.1'
|
|
9
9
|
|
10
10
|
# Requires supporting files with custom matchers and macros, etc,
|
11
11
|
# in ./support/ and its subdirectories.
|
12
|
-
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
|
12
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require File.join("support", File.basename(f))}
|
13
13
|
|
14
14
|
require 'vcr'
|
15
15
|
require 'monkey_patches'
|
data/spec/structs_spec.rb
CHANGED
@@ -2,20 +2,38 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
shared_examples_for "a header normalizer" do
|
4
4
|
let(:instance) do
|
5
|
-
with_headers('Some_Header' => 'value1', 'aNother' => ['a', 'b'], 'third' => [], '
|
5
|
+
with_headers('Some_Header' => 'value1', 'aNother' => ['a', 'b'], 'third' => [], 'fourth' => nil)
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'normalizes the hash to lower case keys and arrays of values' do
|
9
|
-
instance.headers.should ==
|
10
|
-
|
11
|
-
'another' => ['a', 'b'],
|
12
|
-
'third' => [],
|
13
|
-
'fourth' => []
|
14
|
-
}
|
9
|
+
instance.headers['some_header'].should == ['value1']
|
10
|
+
instance.headers['another'].should == ['a', 'b']
|
15
11
|
end
|
16
12
|
|
17
|
-
it '
|
18
|
-
|
13
|
+
it 'removes empty headers' do
|
14
|
+
instance.headers.should_not have_key('third')
|
15
|
+
instance.headers.should_not have_key('fourth')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'filters out unimportant default values set by the HTTP library' do
|
19
|
+
instance = with_headers('accept' => ['*/*'], 'connection' => 'close', 'http-user' => ['foo'], 'expect' => ['', 'bar'])
|
20
|
+
instance.headers.should == { 'http-user' => ['foo'], 'expect' => ['bar'] }
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'sets empty hash header to nil' do
|
24
|
+
with_headers({}).headers.should be_nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
shared_examples_for "a body normalizer" do
|
29
|
+
it 'sets empty string to nil' do
|
30
|
+
instance('').body.should be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "ensures the body is serialized to yaml as a raw string" do
|
34
|
+
body = "My String"
|
35
|
+
body.instance_variable_set(:@foo, 7)
|
36
|
+
instance(body).body.to_yaml.should == "My String".to_yaml
|
19
37
|
end
|
20
38
|
end
|
21
39
|
|
@@ -67,7 +85,7 @@ describe VCR::Request do
|
|
67
85
|
it { should be_instance_of(VCR::Request) }
|
68
86
|
its(:method) { should == :post }
|
69
87
|
its(:body) { should == 'id=7' }
|
70
|
-
its(:headers) { should == { "
|
88
|
+
its(:headers) { should == { "content-type" => ["application/x-www-form-urlencoded"] } }
|
71
89
|
|
72
90
|
it 'sets the uri using the http_stubbing_adapter.request_uri' do
|
73
91
|
VCR.http_stubbing_adapter.should_receive(:request_uri).with(net_http, request).and_return('foo/bar')
|
@@ -80,6 +98,12 @@ describe VCR::Request do
|
|
80
98
|
described_class.new(:get, 'http://example.com/', nil, headers)
|
81
99
|
end
|
82
100
|
end
|
101
|
+
|
102
|
+
it_behaves_like 'a body normalizer' do
|
103
|
+
def instance(body)
|
104
|
+
described_class.new(:get, 'http://example.com/', body, {})
|
105
|
+
end
|
106
|
+
end
|
83
107
|
end
|
84
108
|
|
85
109
|
describe VCR::ResponseStatus do
|
@@ -91,6 +115,15 @@ describe VCR::ResponseStatus do
|
|
91
115
|
its(:code) { should == 200 }
|
92
116
|
its(:message) { should == 'OK' }
|
93
117
|
end
|
118
|
+
|
119
|
+
it 'chomps leading and trailing spaces on the status message' do
|
120
|
+
described_class.new(200, ' OK ').message.should == 'OK'
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'sets status message to nil when it is the empty string' do
|
124
|
+
described_class.new(200, '').message.should be_nil
|
125
|
+
described_class.new(200, ' ').message.should be_nil
|
126
|
+
end
|
94
127
|
end
|
95
128
|
|
96
129
|
describe VCR::Response do
|
@@ -103,7 +136,6 @@ describe VCR::Response do
|
|
103
136
|
its(:http_version) { should == '1.1' }
|
104
137
|
its(:headers) { should == {
|
105
138
|
"last-modified" => ['Tue, 15 Nov 2005 13:24:10 GMT'],
|
106
|
-
"connection" => ['close'],
|
107
139
|
"etag" => ["\"24ec5-1b6-4059a80bfd280\""],
|
108
140
|
"content-type" => ["text/html; charset=UTF-8"],
|
109
141
|
"date" => ['Wed, 31 Mar 2010 02:43:26 GMT'],
|
@@ -125,11 +157,10 @@ describe VCR::Response do
|
|
125
157
|
end
|
126
158
|
end
|
127
159
|
|
128
|
-
|
129
|
-
body
|
130
|
-
|
131
|
-
|
132
|
-
instance.body.to_yaml.should == "My String".to_yaml
|
160
|
+
it_behaves_like 'a body normalizer' do
|
161
|
+
def instance(body)
|
162
|
+
described_class.new(:status, {}, body, '1.1')
|
163
|
+
end
|
133
164
|
end
|
134
165
|
end
|
135
166
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rack'
|
2
2
|
require 'rack/handler/webrick'
|
3
|
+
require 'net/http'
|
3
4
|
|
4
5
|
# The code for this is inspired by Capybara's server:
|
5
6
|
# http://github.com/jnicklas/capybara/blob/0.3.9/lib/capybara/server.rb
|
@@ -21,8 +22,8 @@ module VCR
|
|
21
22
|
|
22
23
|
attr_reader :port
|
23
24
|
|
24
|
-
def initialize(rack_app)
|
25
|
-
@port = find_available_port
|
25
|
+
def initialize(rack_app, port = nil)
|
26
|
+
@port = port || find_available_port
|
26
27
|
@rack_app = rack_app
|
27
28
|
concurrently { boot }
|
28
29
|
wait_until(10, "Boot failed.") { booted? }
|
@@ -53,9 +54,7 @@ module VCR
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def concurrently
|
56
|
-
if
|
57
|
-
# Patron times out when the server is running in a separate thread in the same process,
|
58
|
-
# so use a separate process.
|
57
|
+
if should_use_subprocess?
|
59
58
|
pid = Process.fork do
|
60
59
|
yield
|
61
60
|
exit # manually exit; otherwise this sub-process will re-run the specs that haven't run yet.
|
@@ -77,6 +76,13 @@ module VCR
|
|
77
76
|
end
|
78
77
|
end
|
79
78
|
|
79
|
+
def should_use_subprocess?
|
80
|
+
# Patron times out when the server is running in a separate thread in the same process,
|
81
|
+
# so use a separate process.
|
82
|
+
# In all other cases, we can use a thread (it's faster!)
|
83
|
+
defined?(Patron)
|
84
|
+
end
|
85
|
+
|
80
86
|
def wait_until(timeout, error_message, &block)
|
81
87
|
start_time = Time.now
|
82
88
|
|
data/vcr.gemspec
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: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 2
|
10
|
+
version: 1.3.2
|
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-11-
|
18
|
+
date: 2010-11-16 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -133,6 +133,22 @@ dependencies:
|
|
133
133
|
prerelease: false
|
134
134
|
- !ruby/object:Gem::Dependency
|
135
135
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
136
|
+
none: false
|
137
|
+
requirements:
|
138
|
+
- - ~>
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
hash: 19
|
141
|
+
segments:
|
142
|
+
- 1
|
143
|
+
- 1
|
144
|
+
- 0
|
145
|
+
version: 1.1.0
|
146
|
+
requirement: *id008
|
147
|
+
type: :development
|
148
|
+
name: sinatra
|
149
|
+
prerelease: false
|
150
|
+
- !ruby/object:Gem::Dependency
|
151
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
136
152
|
none: false
|
137
153
|
requirements:
|
138
154
|
- - ~>
|
@@ -143,12 +159,12 @@ dependencies:
|
|
143
159
|
- 0
|
144
160
|
- 0
|
145
161
|
version: 1.0.0
|
146
|
-
requirement: *
|
162
|
+
requirement: *id009
|
147
163
|
type: :development
|
148
164
|
name: bundler
|
149
165
|
prerelease: false
|
150
166
|
- !ruby/object:Gem::Dependency
|
151
|
-
version_requirements: &
|
167
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
152
168
|
none: false
|
153
169
|
requirements:
|
154
170
|
- - ~>
|
@@ -159,12 +175,12 @@ dependencies:
|
|
159
175
|
- 9
|
160
176
|
- 4
|
161
177
|
version: 0.9.4
|
162
|
-
requirement: *
|
178
|
+
requirement: *id010
|
163
179
|
type: :development
|
164
180
|
name: cucumber
|
165
181
|
prerelease: false
|
166
182
|
- !ruby/object:Gem::Dependency
|
167
|
-
version_requirements: &
|
183
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
168
184
|
none: false
|
169
185
|
requirements:
|
170
186
|
- - ~>
|
@@ -175,12 +191,12 @@ dependencies:
|
|
175
191
|
- 6
|
176
192
|
- 0
|
177
193
|
version: 1.6.0
|
178
|
-
requirement: *
|
194
|
+
requirement: *id011
|
179
195
|
type: :development
|
180
196
|
name: webmock
|
181
197
|
prerelease: false
|
182
198
|
- !ruby/object:Gem::Dependency
|
183
|
-
version_requirements: &
|
199
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
184
200
|
none: false
|
185
201
|
requirements:
|
186
202
|
- - ~>
|
@@ -191,12 +207,12 @@ dependencies:
|
|
191
207
|
- 7
|
192
208
|
- 8
|
193
209
|
version: 0.7.8
|
194
|
-
requirement: *
|
210
|
+
requirement: *id012
|
195
211
|
type: :development
|
196
212
|
name: curb
|
197
213
|
prerelease: false
|
198
214
|
- !ruby/object:Gem::Dependency
|
199
|
-
version_requirements: &
|
215
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
200
216
|
none: false
|
201
217
|
requirements:
|
202
218
|
- - ~>
|
@@ -207,12 +223,12 @@ dependencies:
|
|
207
223
|
- 4
|
208
224
|
- 6
|
209
225
|
version: 0.4.6
|
210
|
-
requirement: *
|
226
|
+
requirement: *id013
|
211
227
|
type: :development
|
212
228
|
name: patron
|
213
229
|
prerelease: false
|
214
230
|
- !ruby/object:Gem::Dependency
|
215
|
-
version_requirements: &
|
231
|
+
version_requirements: &id014 !ruby/object:Gem::Requirement
|
216
232
|
none: false
|
217
233
|
requirements:
|
218
234
|
- - ~>
|
@@ -223,12 +239,12 @@ dependencies:
|
|
223
239
|
- 2
|
224
240
|
- 7
|
225
241
|
version: 0.2.7
|
226
|
-
requirement: *
|
242
|
+
requirement: *id014
|
227
243
|
type: :development
|
228
244
|
name: em-http-request
|
229
245
|
prerelease: false
|
230
246
|
- !ruby/object:Gem::Dependency
|
231
|
-
version_requirements: &
|
247
|
+
version_requirements: &id015 !ruby/object:Gem::Requirement
|
232
248
|
none: false
|
233
249
|
requirements:
|
234
250
|
- - ~>
|
@@ -239,7 +255,7 @@ dependencies:
|
|
239
255
|
- 2
|
240
256
|
- 0
|
241
257
|
version: 0.2.0
|
242
|
-
requirement: *
|
258
|
+
requirement: *id015
|
243
259
|
type: :development
|
244
260
|
name: typhoeus
|
245
261
|
prerelease: false
|
@@ -256,7 +272,6 @@ files:
|
|
256
272
|
- .gitignore
|
257
273
|
- .gitmodules
|
258
274
|
- CHANGELOG.md
|
259
|
-
- FullBuildRakeFile
|
260
275
|
- Gemfile
|
261
276
|
- Gemfile.lock
|
262
277
|
- Guardfile
|
@@ -265,37 +280,31 @@ files:
|
|
265
280
|
- Rakefile
|
266
281
|
- TODO.md
|
267
282
|
- benchmarks/http_stubbing_libraries.rb
|
268
|
-
-
|
269
|
-
- features/
|
270
|
-
- features/
|
271
|
-
- features/
|
272
|
-
- features/
|
273
|
-
- features/
|
274
|
-
- features/
|
275
|
-
- features/
|
276
|
-
- features/
|
277
|
-
- features/
|
278
|
-
- features/
|
279
|
-
- features/
|
280
|
-
- features/
|
281
|
-
- features/
|
282
|
-
- features/
|
283
|
-
- features/
|
284
|
-
- features/
|
285
|
-
- features/
|
286
|
-
- features/fixtures/vcr_cassettes/not_1.9.1/record_all.yml
|
287
|
-
- features/fixtures/vcr_cassettes/not_1.9.1/replay_localhost_cassette.yml
|
288
|
-
- features/http_client.feature
|
289
|
-
- features/net_http.feature
|
290
|
-
- features/record_response.feature
|
291
|
-
- features/replay_recorded_response.feature
|
292
|
-
- features/rspec.feature
|
293
|
-
- features/step_definitions/http_client_steps.rb
|
294
|
-
- features/step_definitions/net_http_steps.rb
|
295
|
-
- features/step_definitions/vcr_steps.rb
|
283
|
+
- cucumber.yml
|
284
|
+
- features/README.md
|
285
|
+
- features/cassettes/automatic_re_recording.feature
|
286
|
+
- features/cassettes/dynamic_erb.feature
|
287
|
+
- features/cassettes/format.feature
|
288
|
+
- features/cassettes/no_cassette.feature
|
289
|
+
- features/cassettes/record_modes/all.feature
|
290
|
+
- features/cassettes/record_modes/new_episodes.feature
|
291
|
+
- features/cassettes/record_modes/none.feature
|
292
|
+
- features/cassettes/request_matching.feature
|
293
|
+
- features/configuration/cassette_library_dir.feature
|
294
|
+
- features/configuration/default_cassette_options.feature
|
295
|
+
- features/configuration/ignore_localhost.feature
|
296
|
+
- features/configuration/stub_with.feature
|
297
|
+
- features/http_libraries/net_http.feature
|
298
|
+
- features/step_definitions/cli_steps.rb
|
299
|
+
- features/support/aruba_workaround/aruba_patches.rb
|
300
|
+
- features/support/aruba_workaround/background_process.rb
|
296
301
|
- features/support/env.rb
|
297
|
-
- features/
|
298
|
-
-
|
302
|
+
- features/support/http_lib_filters.rb
|
303
|
+
- features/support/vcr_cucumber_helpers.rb
|
304
|
+
- features/test_frameworks/cucumber.feature
|
305
|
+
- features/test_frameworks/rspec.feature
|
306
|
+
- features/test_frameworks/shoulda.feature
|
307
|
+
- features/test_frameworks/test_unit.feature
|
299
308
|
- lib/vcr.rb
|
300
309
|
- lib/vcr/basic_object.rb
|
301
310
|
- lib/vcr/cassette.rb
|
@@ -315,6 +324,8 @@ files:
|
|
315
324
|
- lib/vcr/rspec.rb
|
316
325
|
- lib/vcr/structs.rb
|
317
326
|
- lib/vcr/version.rb
|
327
|
+
- script/FullBuildRakeFile
|
328
|
+
- script/full_build
|
318
329
|
- spec/cassette_spec.rb
|
319
330
|
- spec/config_spec.rb
|
320
331
|
- spec/cucumber_tags_spec.rb
|
@@ -403,36 +414,30 @@ signing_key:
|
|
403
414
|
specification_version: 3
|
404
415
|
summary: Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
|
405
416
|
test_files:
|
406
|
-
- features/
|
407
|
-
- features/
|
408
|
-
- features/
|
409
|
-
- features/
|
410
|
-
- features/
|
411
|
-
- features/
|
412
|
-
- features/
|
413
|
-
- features/
|
414
|
-
- features/
|
415
|
-
- features/
|
416
|
-
- features/
|
417
|
-
- features/
|
418
|
-
- features/
|
419
|
-
- features/
|
420
|
-
- features/
|
421
|
-
- features/
|
422
|
-
- features/
|
423
|
-
- features/fixtures/vcr_cassettes/not_1.9.1/not_the_real_response.yml
|
424
|
-
- features/fixtures/vcr_cassettes/not_1.9.1/record_all.yml
|
425
|
-
- features/fixtures/vcr_cassettes/not_1.9.1/replay_localhost_cassette.yml
|
426
|
-
- features/http_client.feature
|
427
|
-
- features/net_http.feature
|
428
|
-
- features/record_response.feature
|
429
|
-
- features/replay_recorded_response.feature
|
430
|
-
- features/rspec.feature
|
431
|
-
- features/step_definitions/http_client_steps.rb
|
432
|
-
- features/step_definitions/net_http_steps.rb
|
433
|
-
- features/step_definitions/vcr_steps.rb
|
417
|
+
- features/README.md
|
418
|
+
- features/cassettes/automatic_re_recording.feature
|
419
|
+
- features/cassettes/dynamic_erb.feature
|
420
|
+
- features/cassettes/format.feature
|
421
|
+
- features/cassettes/no_cassette.feature
|
422
|
+
- features/cassettes/record_modes/all.feature
|
423
|
+
- features/cassettes/record_modes/new_episodes.feature
|
424
|
+
- features/cassettes/record_modes/none.feature
|
425
|
+
- features/cassettes/request_matching.feature
|
426
|
+
- features/configuration/cassette_library_dir.feature
|
427
|
+
- features/configuration/default_cassette_options.feature
|
428
|
+
- features/configuration/ignore_localhost.feature
|
429
|
+
- features/configuration/stub_with.feature
|
430
|
+
- features/http_libraries/net_http.feature
|
431
|
+
- features/step_definitions/cli_steps.rb
|
432
|
+
- features/support/aruba_workaround/aruba_patches.rb
|
433
|
+
- features/support/aruba_workaround/background_process.rb
|
434
434
|
- features/support/env.rb
|
435
|
-
- features/
|
435
|
+
- features/support/http_lib_filters.rb
|
436
|
+
- features/support/vcr_cucumber_helpers.rb
|
437
|
+
- features/test_frameworks/cucumber.feature
|
438
|
+
- features/test_frameworks/rspec.feature
|
439
|
+
- features/test_frameworks/shoulda.feature
|
440
|
+
- features/test_frameworks/test_unit.feature
|
436
441
|
- spec/cassette_spec.rb
|
437
442
|
- spec/config_spec.rb
|
438
443
|
- spec/cucumber_tags_spec.rb
|