vcr 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +12 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +4 -5
- data/README.md +1 -1
- data/Rakefile +28 -34
- data/features/step_definitions/net_http_steps.rb +2 -2
- data/features/step_definitions/vcr_steps.rb +3 -1
- data/lib/vcr/extensions/net_http.rb +8 -4
- data/lib/vcr/extensions/net_http_response.rb +9 -19
- data/lib/vcr/http_stubbing_adapters/fakeweb.rb +4 -0
- data/lib/vcr/http_stubbing_adapters/webmock.rb +6 -0
- data/lib/vcr/version.rb +1 -1
- data/spec/extensions/net_http_response_spec.rb +67 -62
- data/spec/http_stubbing_adapters/fakeweb_spec.rb +8 -0
- data/spec/http_stubbing_adapters/webmock_spec.rb +13 -0
- data/spec/monkey_patches.rb +70 -0
- data/spec/spec_helper.rb +5 -0
- data/vcr.gemspec +2 -2
- metadata +11 -11
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
#Changelog
|
2
2
|
|
3
|
+
## 1.1.2 (September 9, 2010)
|
4
|
+
|
5
|
+
* Fixed a minor bug with the WebMock integration: WebMock extends each `Net::HTTPResponse` with an extension
|
6
|
+
module after reading the body, and VCR was doing the same thing, leading to some slight deviance from
|
7
|
+
standard Net::HTTP behavior. The fix prevents VCR from adding the same extension to a `Net::HTTPResponse`
|
8
|
+
that has already been extende by WebMock.
|
9
|
+
* Fixed a minor bug in the `VCR::Net::HTTPResponse` module so that it correctly handles nil bodies (such as
|
10
|
+
for a HEAD request).
|
11
|
+
* Refactored `VCR::Net::HTTPResponse` module so it is implemented in a much simpler manner.
|
12
|
+
* Updated specs and features so they pass against the latest WebMock release (1.3.5).
|
13
|
+
* Minor documentation updates.
|
14
|
+
|
3
15
|
## 1.1.1 (August 26, 2010)
|
4
16
|
|
5
17
|
* Updated to use and require FakeWeb 1.3.0. It includes a fix for a bug related to multiple values for the
|
data/Gemfile
CHANGED
@@ -4,6 +4,12 @@ gemspec
|
|
4
4
|
group :development do
|
5
5
|
# Our specs rely on something in rspec-core master that hasn't been released yet.
|
6
6
|
gem 'rspec-core', :git => 'git://github.com/rspec/rspec-core.git'
|
7
|
+
|
8
|
+
# patron and em-http-request can't install on JRuby, so we have to limit their platform here.
|
9
|
+
platforms :ruby do
|
10
|
+
gem 'patron', '~> 0.4.6'
|
11
|
+
gem 'em-http-request', '~> 0.2.7'
|
12
|
+
end
|
7
13
|
end
|
8
14
|
|
9
15
|
# Additional gems that are useful, but not required for development.
|
data/Gemfile.lock
CHANGED
@@ -7,7 +7,7 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
vcr (1.1.
|
10
|
+
vcr (1.1.2)
|
11
11
|
|
12
12
|
GEM
|
13
13
|
remote: http://rubygems.org/
|
@@ -36,7 +36,6 @@ GEM
|
|
36
36
|
addressable (>= 2.0.0)
|
37
37
|
eventmachine (>= 0.12.9)
|
38
38
|
eventmachine (0.12.10)
|
39
|
-
eventmachine (0.12.10-java)
|
40
39
|
fakeweb (1.3.0)
|
41
40
|
ffi (0.6.3)
|
42
41
|
rake (>= 0.8.7)
|
@@ -91,7 +90,7 @@ GEM
|
|
91
90
|
term-ansicolor (1.0.5)
|
92
91
|
trollop (1.16.2)
|
93
92
|
weakling (0.0.4-java)
|
94
|
-
webmock (1.3.
|
93
|
+
webmock (1.3.5)
|
95
94
|
addressable (>= 2.1.1)
|
96
95
|
crack (>= 0.1.7)
|
97
96
|
|
@@ -100,7 +99,7 @@ PLATFORMS
|
|
100
99
|
ruby
|
101
100
|
|
102
101
|
DEPENDENCIES
|
103
|
-
bundler (~> 1.0.0
|
102
|
+
bundler (~> 1.0.0)
|
104
103
|
capybara (~> 0.3.9)
|
105
104
|
cucumber (~> 0.8.5)
|
106
105
|
em-http-request (~> 0.2.7)
|
@@ -116,4 +115,4 @@ DEPENDENCIES
|
|
116
115
|
ruby-debug-base19 (= 0.11.23)
|
117
116
|
ruby-debug19
|
118
117
|
vcr!
|
119
|
-
webmock (
|
118
|
+
webmock (~> 1.3.5)
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ maintenance) and accurate (the response from example.com will contain the same h
|
|
47
47
|
(all HTTP stubbing libraries), [Patron](http://github.com/toland/patron) (WebMock only),
|
48
48
|
[HTTPClient](http://github.com/nahi/httpclient) (WebMock only) and
|
49
49
|
[em-http-request](http://github.com/igrigorik/em-http-request) (WebMock only).
|
50
|
-
* Request matching is configurable based on HTTP method, URI, host, body and headers.
|
50
|
+
* Request matching is configurable based on HTTP method, URI, host, path, body and headers.
|
51
51
|
* The same request can receive different responses in different tests--just use different cassettes.
|
52
52
|
* The recorded requests and responses are stored on disk as YAML and can easily be inspected and edited.
|
53
53
|
* Dynamic responses are supported using ERB.
|
data/Rakefile
CHANGED
@@ -19,52 +19,46 @@ task :cleanup_rcov_files do
|
|
19
19
|
rm_rf 'coverage.data'
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
}
|
22
|
+
permutations = {
|
23
|
+
'fakeweb' => %w( net/http ),
|
24
|
+
'webmock' => %w( net/http httpclient patron em-http-request )
|
25
|
+
}
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
require 'cucumber/rake/task'
|
28
|
+
namespace :features do
|
29
|
+
permutations.each do |http_stubbing_adapter, http_libraries|
|
30
|
+
features_subtasks = []
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
namespace http_stubbing_adapter do
|
33
|
+
http_libraries.each do |http_lib|
|
34
|
+
next if RUBY_PLATFORM =~ /java/ && %w( patron em-http-request ).include?(http_lib)
|
36
35
|
|
37
|
-
|
38
|
-
|
36
|
+
sanitized_http_lib = http_lib.gsub('/', '_')
|
37
|
+
features_subtasks << "features:#{http_stubbing_adapter}:#{sanitized_http_lib}"
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
task "#{sanitized_http_lib}_prep" do
|
40
|
+
ENV['HTTP_STUBBING_ADAPTER'] = http_stubbing_adapter
|
41
|
+
ENV['HTTP_LIB'] = http_lib
|
42
|
+
end
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
44
|
+
Cucumber::Rake::Task.new(
|
45
|
+
{ sanitized_http_lib => "#{features_subtasks.last}_prep" },
|
46
|
+
"Run the features using #{http_stubbing_adapter} and #{http_lib}") do |t|
|
47
|
+
t.cucumber_opts = ['--format', 'progress', '--tags', "@#{http_stubbing_adapter},@all_http_libs,@#{sanitized_http_lib}"]
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
end
|
49
|
+
# disable scenarios on heroku that can't pass due to heroku's restrictions
|
50
|
+
t.cucumber_opts += ['--tags', '~@spawns_localhost_server'] if ENV.keys.include?('HEROKU_SLUG')
|
53
51
|
end
|
54
52
|
end
|
55
|
-
|
56
|
-
desc "Run the features using #{http_stubbing_adapter} and each of #{http_stubbing_adapter}'s supported http libraries"
|
57
|
-
task http_stubbing_adapter => features_subtasks
|
58
53
|
end
|
59
|
-
end
|
60
54
|
|
61
|
-
|
62
|
-
|
63
|
-
rescue LoadError
|
64
|
-
task :features do
|
65
|
-
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
55
|
+
desc "Run the features using #{http_stubbing_adapter} and each of #{http_stubbing_adapter}'s supported http libraries"
|
56
|
+
task http_stubbing_adapter => features_subtasks
|
66
57
|
end
|
67
58
|
end
|
68
59
|
|
60
|
+
desc "Run the features using each supported permutation of http stubbing library and http library."
|
61
|
+
task :features => permutations.keys.map { |a| "features:#{a}" }
|
62
|
+
|
69
63
|
task :default => [:spec, :features]
|
70
64
|
|
@@ -19,8 +19,8 @@ When /^I make a replayed asynchronous Net::HTTP get request to "([^\"]*)"$/ do |
|
|
19
19
|
capture_response(url) do |uri, path|
|
20
20
|
result_body = ''
|
21
21
|
result = Net::HTTP.new(uri.host, uri.port).request_get(path) { |r| r.read_body { |fragment| result_body << fragment } }
|
22
|
-
|
23
|
-
|
22
|
+
def result_body.body; self; end # make the string a fake response (so response.body can be called on it)
|
23
|
+
result_body
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -210,7 +210,9 @@ Then /^(?:the )?response(?: (\d+))? for "([^\"]*)" should match \/(.+)\/$/ do |r
|
|
210
210
|
response_num = response_num.to_i || 0
|
211
211
|
response_num -= 1 if response_num > 0 # translate to 0-based array index.
|
212
212
|
regex = /#{regex_str}/i
|
213
|
-
|
213
|
+
response = @http_requests[url][response_num]
|
214
|
+
raise response if response.is_a?(Exception)
|
215
|
+
get_body_string(response).should =~ regex
|
214
216
|
end
|
215
217
|
|
216
218
|
Then /^there should not be a "([^\"]*)" library file$/ do |cassette_name|
|
@@ -2,20 +2,24 @@ require 'net/http'
|
|
2
2
|
|
3
3
|
module Net
|
4
4
|
class HTTP
|
5
|
-
|
6
|
-
|
7
|
-
def request(request, body = nil, &block)
|
5
|
+
def request_with_vcr(request, body = nil, &block)
|
8
6
|
vcr_request = VCR::Request.from_net_http_request(self, request)
|
9
7
|
response = request_without_vcr(request, body)
|
10
8
|
|
11
9
|
match_attributes = (cass = VCR.current_cassette) ? cass.match_requests_on : VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES
|
12
10
|
if started? && !VCR.http_stubbing_adapter.request_stubbed?(vcr_request, match_attributes)
|
13
11
|
VCR.record_http_interaction VCR::HTTPInteraction.new(vcr_request, VCR::Response.from_net_http_response(response))
|
14
|
-
|
12
|
+
|
13
|
+
if VCR.http_stubbing_adapter.should_unwind_response?(response)
|
14
|
+
response.extend VCR::Net::HTTPResponse # "unwind" the response
|
15
|
+
end
|
15
16
|
end
|
16
17
|
|
17
18
|
yield response if block_given?
|
18
19
|
response
|
19
20
|
end
|
21
|
+
|
22
|
+
alias request_without_vcr request
|
23
|
+
alias request request_with_vcr
|
20
24
|
end
|
21
25
|
end
|
@@ -12,29 +12,19 @@
|
|
12
12
|
module VCR
|
13
13
|
module Net
|
14
14
|
module HTTPResponse
|
15
|
-
def self.extended(object)
|
16
|
-
object.instance_variable_set(:@__orig_body_for_vcr__, object.instance_variable_get(:@body))
|
17
|
-
end
|
18
|
-
|
19
15
|
def read_body(dest = nil, &block)
|
20
|
-
if @
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@body
|
29
|
-
else
|
30
|
-
@body = @__orig_body_for_vcr__
|
31
|
-
end
|
32
|
-
else
|
33
|
-
super
|
16
|
+
return super if @__read_body_previously_called
|
17
|
+
return @body if dest.nil? && block.nil?
|
18
|
+
raise ArgumentError.new("both arg and block given for HTTP method") if dest && block
|
19
|
+
|
20
|
+
if @body
|
21
|
+
dest ||= ::Net::ReadAdapter.new(block)
|
22
|
+
dest << @body
|
23
|
+
@body = dest
|
34
24
|
end
|
35
25
|
ensure
|
36
26
|
# allow subsequent calls to #read_body to proceed as normal, without our hack...
|
37
|
-
@
|
27
|
+
@__read_body_previously_called = true
|
38
28
|
end
|
39
29
|
end
|
40
30
|
end
|
data/lib/vcr/version.rb
CHANGED
@@ -1,85 +1,90 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
|
-
describe
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
::WebMock::CallbackRegistry.reset
|
3
|
+
describe VCR::Net::HTTPResponse do
|
4
|
+
# Disable the VCR/FakeWeb/WebMock Net::HTTP monkey patches so we don't have collisions with these specs
|
5
|
+
before(:all) { MonkeyPatches.disable! }
|
6
|
+
after(:all) { MonkeyPatches.enable! }
|
7
|
+
|
8
|
+
def self.it_allows_the_body_to_be_read(expected_regex)
|
9
|
+
it 'allows the body to be read using #body' do
|
10
|
+
response.body.to_s.should =~ expected_regex
|
12
11
|
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
::WebMock::CallbackRegistry.add_callback(cb[:options], cb[:block])
|
17
|
-
end
|
13
|
+
it 'allows the body to be read using #read_body' do
|
14
|
+
response.read_body.to_s.should =~ expected_regex
|
18
15
|
end
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
17
|
+
it 'allows the body to be read using #read_body with a block' do
|
18
|
+
yielded_body = ''
|
19
|
+
ret_val = response { |r| r.read_body { |s| yielded_body << s.to_s } }
|
20
|
+
yielded_body.should =~ expected_regex
|
21
|
+
end
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
it 'allows the body to be read by passing a destination string to #read_body' do
|
24
|
+
dest = ''
|
25
|
+
ret_val = response { |r| r.read_body(dest) }.body
|
26
|
+
dest.to_s.should =~ expected_regex
|
27
|
+
ret_val.to_s.should == dest
|
28
|
+
end
|
27
29
|
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
it 'raises an ArgumentError if both a destination string and a block is given to #read_body' do
|
31
|
+
dest = ''
|
32
|
+
expect { response { |r| r.read_body(dest) { |s| } } }.should raise_error(ArgumentError, 'both arg and block given for HTTP method')
|
33
|
+
end
|
31
34
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
ret_val.should be_instance_of(Net::ReadAdapter)
|
37
|
-
end
|
35
|
+
it 'raises an IOError when #read_body is called twice with a block' do
|
36
|
+
response { |r| r.read_body { |s| } }
|
37
|
+
expect { response { |r| r.read_body { |s| } } }.to raise_error(IOError, /read_body called twice/)
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
it 'raises an IOError when #read_body is called twice with a destination string' do
|
41
|
+
dest = ''
|
42
|
+
response { |r| r.read_body(dest) }
|
43
|
+
expect { response { |r| r.read_body(dest) } }.to raise_error(IOError, /read_body called twice/)
|
44
|
+
end
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
47
|
+
{ :get => /You have reached this web page by typing.*example\.com/, :head => /\A\z/ }.each do |http_verb, expected_body_regex|
|
48
|
+
context "for a #{http_verb.to_s.upcase} request" do
|
49
|
+
let(:http_verb_method) { :"request_#{http_verb}" }
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
def response(&block)
|
52
|
+
if @response && block
|
53
|
+
block.call(@response)
|
54
|
+
return @response
|
55
|
+
end
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
@response ||= begin
|
58
|
+
http = Net::HTTP.new('example.com', 80)
|
59
|
+
res = http.send(http_verb_method, '/', &block)
|
60
|
+
res.should_not be_a(VCR::Net::HTTPResponse)
|
61
|
+
res.should_not be_a(::WebMock::Net::HTTPResponse)
|
62
|
+
res
|
63
|
+
end
|
60
64
|
end
|
61
|
-
end
|
62
65
|
|
63
|
-
|
64
|
-
|
65
|
-
http = Net::HTTP.new('example.com', 80)
|
66
|
-
dest = ''
|
67
|
-
@response = http.request_get('/') { |res| res.read_body(dest) }
|
68
|
-
@response.extend VCR::Net::HTTPResponse
|
66
|
+
context 'when the body has not already been read' do
|
67
|
+
it_allows_the_body_to_be_read(expected_body_regex)
|
69
68
|
end
|
70
69
|
|
71
|
-
|
72
|
-
|
70
|
+
context 'when the body has already been read using #read_body and a dest string' do
|
71
|
+
before(:each) do
|
72
|
+
dest = ''
|
73
|
+
response { |res| res.read_body(dest) }
|
74
|
+
response.extend VCR::Net::HTTPResponse
|
75
|
+
end
|
73
76
|
|
74
|
-
|
75
|
-
before(:each) do
|
76
|
-
http = Net::HTTP.new('example.com', 80)
|
77
|
-
@response = http.request_get('/')
|
78
|
-
@response.body
|
79
|
-
@response.extend VCR::Net::HTTPResponse
|
77
|
+
it_allows_the_body_to_be_read(expected_body_regex)
|
80
78
|
end
|
81
79
|
|
82
|
-
|
80
|
+
context 'when the body has already been read using #body' do
|
81
|
+
before(:each) do
|
82
|
+
response.body
|
83
|
+
response.extend VCR::Net::HTTPResponse
|
84
|
+
end
|
85
|
+
|
86
|
+
it_allows_the_body_to_be_read(expected_body_regex)
|
87
|
+
end
|
83
88
|
end
|
84
89
|
end
|
85
90
|
end
|
@@ -3,6 +3,14 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
3
3
|
describe VCR::HttpStubbingAdapters::FakeWeb do
|
4
4
|
it_should_behave_like 'an http stubbing adapter', ['net/http'], [:method, :uri, :host, :path]
|
5
5
|
|
6
|
+
describe '#should_unwind_response?' do
|
7
|
+
let(:response) { ::Net::HTTPOK.new('1.1', 200, 'OK') }
|
8
|
+
|
9
|
+
it 'returns true' do
|
10
|
+
described_class.should_unwind_response?(response).should be_true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
describe '#check_version!' do
|
7
15
|
disable_warnings
|
8
16
|
before(:each) { @orig_version = FakeWeb::VERSION }
|
@@ -5,6 +5,19 @@ describe VCR::HttpStubbingAdapters::WebMock do
|
|
5
5
|
%w[net/http patron httpclient em-http-request],
|
6
6
|
[:method, :uri, :host, :path, :body, :headers]
|
7
7
|
|
8
|
+
describe '#should_unwind_response?' do
|
9
|
+
let(:response) { ::Net::HTTPOK.new('1.1', 200, 'OK') }
|
10
|
+
|
11
|
+
it 'returns true when the response has not been extended with WebMock::Net::HTTPResponse' do
|
12
|
+
described_class.should_unwind_response?(response).should be_true
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns false when the response has been extended with WebMock::Net::HTTPResponse' do
|
16
|
+
response.extend WebMock::Net::HTTPResponse
|
17
|
+
described_class.should_unwind_response?(response).should be_false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
describe '#check_version!' do
|
9
22
|
before(:each) { WebMock.should respond_to(:version) }
|
10
23
|
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module MonkeyPatches
|
2
|
+
extend self
|
3
|
+
|
4
|
+
NET_HTTP_SINGLETON = class << Net::HTTP; self; end
|
5
|
+
|
6
|
+
MONKEY_PATCHES = [
|
7
|
+
[Net::BufferedIO, :initialize],
|
8
|
+
[Net::HTTP, :request],
|
9
|
+
[Net::HTTP, :connect],
|
10
|
+
[NET_HTTP_SINGLETON, :socket_type]
|
11
|
+
]
|
12
|
+
|
13
|
+
def enable!
|
14
|
+
MONKEY_PATCHES.each do |mp|
|
15
|
+
realias mp.first, mp.last, :with_monkeypatches
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def disable!
|
20
|
+
MONKEY_PATCHES.each do |mp|
|
21
|
+
realias mp.first, mp.last, :without_monkeypatches
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def init
|
26
|
+
# capture the monkey patched definitions so we can realias to them in the future
|
27
|
+
MONKEY_PATCHES.each do |mp|
|
28
|
+
capture_method_definition(mp.first, mp.last, false)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def capture_method_definition(klass, method, original)
|
35
|
+
klass.class_eval do
|
36
|
+
monkeypatch_methods = [
|
37
|
+
:with_vcr, :without_vcr,
|
38
|
+
:with_fakeweb, :without_fakeweb,
|
39
|
+
:with_webmock, :without_webmock
|
40
|
+
].select do |m|
|
41
|
+
method_defined?(:"#{method}_#{m}")
|
42
|
+
end
|
43
|
+
|
44
|
+
if original
|
45
|
+
if monkeypatch_methods.size > 0
|
46
|
+
raise "The following monkeypatch methods have already been defined #{method}: #{monkey_patch_methods.inspect}"
|
47
|
+
end
|
48
|
+
alias_name = :"#{method}_without_monkeypatches"
|
49
|
+
else
|
50
|
+
if monkeypatch_methods.size == 0
|
51
|
+
raise "No monkey patch methods have been defined for #{method}"
|
52
|
+
end
|
53
|
+
alias_name = :"#{method}_with_monkeypatches"
|
54
|
+
end
|
55
|
+
|
56
|
+
alias_method alias_name, method
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# capture the original method definitions before the monkey patches have been defined
|
61
|
+
# so we can realias to the originals in the future
|
62
|
+
MONKEY_PATCHES.each do |mp|
|
63
|
+
capture_method_definition(mp.first, mp.last, true)
|
64
|
+
end
|
65
|
+
|
66
|
+
def realias(klass, method, alias_extension)
|
67
|
+
klass.class_eval { alias_method method, :"#{method}_#{alias_extension}" }
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -2,6 +2,8 @@ require 'rubygems'
|
|
2
2
|
require 'bundler'
|
3
3
|
Bundler.setup
|
4
4
|
|
5
|
+
require 'monkey_patches'
|
6
|
+
|
5
7
|
require 'patron' unless RUBY_PLATFORM =~ /java/
|
6
8
|
require 'httpclient'
|
7
9
|
require 'em-http-request' unless RUBY_PLATFORM =~ /java/
|
@@ -38,3 +40,6 @@ RSpec.configure do |config|
|
|
38
40
|
config.filter_run :focus => true
|
39
41
|
config.run_all_when_everything_filtered = true
|
40
42
|
end
|
43
|
+
|
44
|
+
MonkeyPatches.init
|
45
|
+
|
data/vcr.gemspec
CHANGED
@@ -17,14 +17,14 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.required_rubygems_version = '>= 1.3.5'
|
18
18
|
|
19
19
|
{
|
20
|
-
'bundler' => '~> 1.0.0
|
20
|
+
'bundler' => '~> 1.0.0',
|
21
21
|
'rake' => '~> 0.8.7',
|
22
22
|
|
23
23
|
'rspec' => '~> 2.0.0.beta.20',
|
24
24
|
'cucumber' => '~> 0.8.5',
|
25
25
|
|
26
26
|
'fakeweb' => '~> 1.3.0',
|
27
|
-
'webmock' => '1.3.
|
27
|
+
'webmock' => '~> 1.3.5',
|
28
28
|
|
29
29
|
'httpclient' => '~> 2.1.5.2',
|
30
30
|
|
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: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 2
|
10
|
+
version: 1.1.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-
|
18
|
+
date: 2010-09-09 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -107,13 +107,12 @@ dependencies:
|
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
hash:
|
110
|
+
hash: 23
|
111
111
|
segments:
|
112
112
|
- 1
|
113
113
|
- 0
|
114
114
|
- 0
|
115
|
-
|
116
|
-
version: 1.0.0.rc6
|
115
|
+
version: 1.0.0
|
117
116
|
requirement: *id006
|
118
117
|
type: :development
|
119
118
|
name: bundler
|
@@ -154,14 +153,14 @@ dependencies:
|
|
154
153
|
version_requirements: &id009 !ruby/object:Gem::Requirement
|
155
154
|
none: false
|
156
155
|
requirements:
|
157
|
-
- -
|
156
|
+
- - ~>
|
158
157
|
- !ruby/object:Gem::Version
|
159
|
-
hash:
|
158
|
+
hash: 17
|
160
159
|
segments:
|
161
160
|
- 1
|
162
161
|
- 3
|
163
|
-
-
|
164
|
-
version: 1.3.
|
162
|
+
- 5
|
163
|
+
version: 1.3.5
|
165
164
|
requirement: *id009
|
166
165
|
type: :development
|
167
166
|
name: webmock
|
@@ -284,6 +283,7 @@ files:
|
|
284
283
|
- spec/fixtures/not_1.9.1/match_requests_on.yml
|
285
284
|
- spec/http_stubbing_adapters/fakeweb_spec.rb
|
286
285
|
- spec/http_stubbing_adapters/webmock_spec.rb
|
286
|
+
- spec/monkey_patches.rb
|
287
287
|
- spec/request_matcher_spec.rb
|
288
288
|
- spec/spec_helper.rb
|
289
289
|
- spec/structs_spec.rb
|