vcr 0.4.1 → 1.0.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/CHANGELOG.md +34 -0
- data/README.md +89 -21
- data/lib/vcr.rb +12 -1
- data/lib/vcr/cassette.rb +50 -27
- data/lib/vcr/config.rb +9 -0
- data/lib/vcr/deprecations.rb +15 -42
- data/lib/vcr/extensions/net_http.rb +13 -20
- data/lib/vcr/extensions/net_http_response.rb +6 -13
- data/lib/vcr/http_stubbing_adapters/fakeweb.rb +21 -3
- data/lib/vcr/http_stubbing_adapters/webmock.rb +34 -4
- data/lib/vcr/version.rb +16 -0
- metadata +90 -108
- data/.document +0 -5
- data/.gitignore +0 -22
- data/Rakefile +0 -67
- data/VERSION +0 -1
- data/benchmarks/http_stubbing_libraries.rb +0 -59
- data/features/fixtures/vcr_cassettes/1.8.6/cucumber_tags/replay_cassette1.yml +0 -43
- data/features/fixtures/vcr_cassettes/1.8.6/cucumber_tags/replay_cassette2.yml +0 -47
- data/features/fixtures/vcr_cassettes/1.8.6/cucumber_tags/replay_cassette3.yml +0 -85
- data/features/fixtures/vcr_cassettes/1.8.6/nested_replay_cassette.yml +0 -24
- data/features/fixtures/vcr_cassettes/1.8.6/not_the_real_response.yml +0 -43
- data/features/fixtures/vcr_cassettes/1.8.7/cucumber_tags/replay_cassette1.yml +0 -43
- data/features/fixtures/vcr_cassettes/1.8.7/cucumber_tags/replay_cassette2.yml +0 -47
- data/features/fixtures/vcr_cassettes/1.8.7/cucumber_tags/replay_cassette3.yml +0 -85
- data/features/fixtures/vcr_cassettes/1.8.7/nested_replay_cassette.yml +0 -24
- data/features/fixtures/vcr_cassettes/1.8.7/not_the_real_response.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/nested_replay_cassette.yml +0 -32
- data/features/fixtures/vcr_cassettes/1.9.1/not_the_real_response.yml +0 -43
- data/features/record_response.feature +0 -77
- data/features/replay_recorded_response.feature +0 -69
- data/features/step_definitions/vcr_steps.rb +0 -144
- data/features/support/env.rb +0 -64
- data/lib/vcr/extensions/fake_web.rb +0 -20
- data/lib/vcr/extensions/net_read_adapter.rb +0 -22
- data/spec/cassette_spec.rb +0 -213
- data/spec/config_spec.rb +0 -49
- data/spec/cucumber_tags_spec.rb +0 -71
- data/spec/deprecations_spec.rb +0 -67
- data/spec/extensions/net_http_response_spec.rb +0 -86
- data/spec/extensions/net_http_spec.rb +0 -72
- data/spec/extensions/net_read_adapter_spec.rb +0 -10
- data/spec/fixtures/1.8.6/0_3_1_cassette.yml +0 -29
- data/spec/fixtures/1.8.6/cassette_spec/example.yml +0 -110
- data/spec/fixtures/1.8.6/example_net_http.yml +0 -14
- data/spec/fixtures/1.8.6/example_net_http_request.yml +0 -12
- data/spec/fixtures/1.8.6/example_net_http_response.yml +0 -25
- data/spec/fixtures/1.8.6/fake_example.com_responses.yml +0 -90
- data/spec/fixtures/1.8.7/0_3_1_cassette.yml +0 -29
- data/spec/fixtures/1.8.7/cassette_spec/example.yml +0 -110
- data/spec/fixtures/1.8.7/example_net_http.yml +0 -14
- data/spec/fixtures/1.8.7/example_net_http_request.yml +0 -12
- data/spec/fixtures/1.8.7/example_net_http_response.yml +0 -25
- data/spec/fixtures/1.8.7/fake_example.com_responses.yml +0 -90
- data/spec/fixtures/1.9.1/0_3_1_cassette.yml +0 -29
- data/spec/fixtures/1.9.1/cassette_spec/example.yml +0 -110
- data/spec/fixtures/1.9.1/example_net_http.yml +0 -14
- data/spec/fixtures/1.9.1/example_net_http_request.yml +0 -12
- data/spec/fixtures/1.9.1/example_net_http_response.yml +0 -25
- data/spec/fixtures/1.9.1/fake_example.com_responses.yml +0 -90
- data/spec/http_stubbing_adapters/fakeweb_spec.rb +0 -24
- data/spec/http_stubbing_adapters/webmock_spec.rb +0 -23
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -35
- data/spec/structs_spec.rb +0 -95
- data/spec/support/deprecated.rb +0 -18
- data/spec/support/disable_warnings.rb +0 -12
- data/spec/support/http_stubbing_adapter.rb +0 -113
- data/spec/support/temp_cassette_library_dir.rb +0 -16
- data/spec/task_runner_spec.rb +0 -59
- data/spec/vcr_spec.rb +0 -119
- data/vcr.gemspec +0 -147
data/spec/config_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe VCR::Config do
|
4
|
-
describe '#cassette_library_dir=' do
|
5
|
-
temp_dir(File.expand_path(File.dirname(__FILE__) + '/fixtures/config_spec'))
|
6
|
-
|
7
|
-
it 'creates the directory if it does not exist' do
|
8
|
-
lambda { VCR::Config.cassette_library_dir = @temp_dir }.should change { File.exist?(@temp_dir) }.from(false).to(true)
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'does not raise an error if given nil' do
|
12
|
-
lambda { VCR::Config.cassette_library_dir = nil }.should_not raise_error
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe '#default_cassette_options' do
|
17
|
-
it 'always has a hash, even if it is set to nil' do
|
18
|
-
VCR::Config.default_cassette_options = nil
|
19
|
-
VCR::Config.default_cassette_options.should == {}
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe '#http_stubbing_library' do
|
24
|
-
it 'returns the configured value' do
|
25
|
-
[:fakeweb, :webmock].each do |setting|
|
26
|
-
VCR::Config.http_stubbing_library = setting
|
27
|
-
VCR::Config.http_stubbing_library.should == setting
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'when set to nil' do
|
32
|
-
before(:each) { VCR::Config.http_stubbing_library = nil }
|
33
|
-
|
34
|
-
{
|
35
|
-
[:FakeWeb, :WebMock] => nil,
|
36
|
-
[] => nil,
|
37
|
-
[:FakeWeb] => :fakeweb,
|
38
|
-
[:WebMock] => :webmock
|
39
|
-
}.each do |defined_constants, expected_return_value|
|
40
|
-
it "returns #{expected_return_value.inspect} when these constants are defined: #{defined_constants.inspect}" do
|
41
|
-
[:FakeWeb, :WebMock].each do |const|
|
42
|
-
Object.should_receive(:const_defined?).with(const).and_return(defined_constants.include?(const))
|
43
|
-
end
|
44
|
-
VCR::Config.http_stubbing_library.should == expected_return_value
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/spec/cucumber_tags_spec.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe VCR::CucumberTags do
|
4
|
-
before(:each) do
|
5
|
-
@args = { :before => [], :after => [] }
|
6
|
-
@blocks = { :before => [], :after => [] }
|
7
|
-
end
|
8
|
-
|
9
|
-
def Before(*args, &block)
|
10
|
-
@args[:before] << args
|
11
|
-
@blocks[:before] << block
|
12
|
-
end
|
13
|
-
|
14
|
-
def After(*args, &block)
|
15
|
-
@args[:after] << args
|
16
|
-
@blocks[:after] << block
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#tag' do
|
20
|
-
[:before, :after].each do |hook|
|
21
|
-
it "sets up a cucumber #{hook} hook for the given tag that creates a new cassette" do
|
22
|
-
VCR.cucumber_tags { |t| t.tag 'tag_test' }
|
23
|
-
|
24
|
-
@args[hook].should == [['@tag_test']]
|
25
|
-
|
26
|
-
if hook == :before
|
27
|
-
VCR.should_receive(:insert_cassette).with('cucumber_tags/tag_test', {})
|
28
|
-
else
|
29
|
-
VCR.should_receive(:eject_cassette)
|
30
|
-
end
|
31
|
-
@blocks[hook].should have(1).block
|
32
|
-
@blocks[hook].first.call
|
33
|
-
end
|
34
|
-
|
35
|
-
it "sets up separate hooks for each tag, passing the given options to each cassette" do
|
36
|
-
VCR.cucumber_tags { |t| t.tag 'tag_test1', 'tag_test2', :record => :none }
|
37
|
-
@args[hook].should == [['@tag_test1'], ['@tag_test2']]
|
38
|
-
|
39
|
-
if hook == :before
|
40
|
-
VCR.should_receive(:insert_cassette).with('cucumber_tags/tag_test1', { :record => :none }).once
|
41
|
-
VCR.should_receive(:insert_cassette).with('cucumber_tags/tag_test2', { :record => :none }).once
|
42
|
-
else
|
43
|
-
VCR.should_receive(:eject_cassette).twice
|
44
|
-
end
|
45
|
-
@blocks[hook].should have(2).blocks
|
46
|
-
@blocks[hook].each { |b| b.call }
|
47
|
-
end
|
48
|
-
|
49
|
-
it "works with tags that start with an @" do
|
50
|
-
VCR.cucumber_tags { |t| t.tag '@tag_test' }
|
51
|
-
@args[hook].should == [['@tag_test']]
|
52
|
-
|
53
|
-
if hook == :before
|
54
|
-
VCR.should_receive(:insert_cassette).with('cucumber_tags/tag_test', {})
|
55
|
-
else
|
56
|
-
VCR.should_receive(:eject_cassette)
|
57
|
-
end
|
58
|
-
@blocks[hook].should have(1).block
|
59
|
-
@blocks[hook].first.call
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
describe '.tags' do
|
65
|
-
it 'returns the list of cucumber tags' do
|
66
|
-
VCR.cucumber_tags { |t| t.tag 'tag1' }
|
67
|
-
VCR.cucumber_tags { |t| t.tags 'tag7', 'tag12' }
|
68
|
-
VCR::CucumberTags.tags[-3, 3].should == %w(@tag1 @tag7 @tag12)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/spec/deprecations_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'Deprecations' do
|
4
|
-
describe VCR do
|
5
|
-
subject { VCR }
|
6
|
-
deprecated :create_cassette!, :insert_cassette, "WARNING: VCR.create_cassette! is deprecated. Instead, use: VCR.insert_cassette."
|
7
|
-
deprecated :destroy_cassette!, :eject_cassette, "WARNING: VCR.destroy_cassette! is deprecated. Instead, use: VCR.eject_cassette."
|
8
|
-
deprecated :with_cassette, :use_cassette, "WARNING: VCR.with_cassette is deprecated. Instead, use: VCR.use_cassette."
|
9
|
-
end
|
10
|
-
|
11
|
-
describe VCR::Cassette do
|
12
|
-
disable_warnings
|
13
|
-
subject { VCR::Cassette.new('cassette name') }
|
14
|
-
deprecated :destroy!, :eject, "WARNING: VCR::Cassette#destroy! is deprecated. Instead, use: VCR::Cassette#eject."
|
15
|
-
deprecated :cache_file, :file, "WARNING: VCR::Cassette#cache_file is deprecated. Instead, use: VCR::Cassette#file."
|
16
|
-
|
17
|
-
it 'delegates the :unregistered record option to :new_episodes' do
|
18
|
-
cassette = VCR::Cassette.new('cassette name', :record => :unregistered)
|
19
|
-
cassette.record_mode.should == :new_episodes
|
20
|
-
end
|
21
|
-
|
22
|
-
it "prints a warning: WARNING: VCR's :unregistered record mode is deprecated. Instead, use: :new_episodes." do
|
23
|
-
Kernel.should_receive(:warn).with("WARNING: VCR's :unregistered record mode is deprecated. Instead, use: :new_episodes.")
|
24
|
-
VCR::Cassette.new('cassette name', :record => :unregistered)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe VCR::Config do
|
29
|
-
disable_warnings
|
30
|
-
subject { VCR::Config }
|
31
|
-
deprecated :cache_dir, :cassette_library_dir, "WARNING: VCR::Config.cache_dir is deprecated. Instead, use: VCR::Config.cassette_library_dir."
|
32
|
-
|
33
|
-
it 'delegates #cache_dir= to #cassette_library_dir=' do
|
34
|
-
subject.should_receive(:cassette_library_dir=).with(:value)
|
35
|
-
subject.cache_dir = :value
|
36
|
-
end
|
37
|
-
|
38
|
-
it "prints a warning: WARNING: VCR::Config.cache_dir= is deprecated. Instead, use: VCR::Config.cassette_library_dir=." do
|
39
|
-
subject.stub!(:cassette_library_dir=)
|
40
|
-
subject.should_receive(:warn).with("WARNING: VCR::Config.cache_dir= is deprecated. Instead, use: VCR::Config.cassette_library_dir=.")
|
41
|
-
subject.cache_dir = :value
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#default_cassette_record_mode=' do
|
45
|
-
it 'sets the default_cassette_options[:record] option' do
|
46
|
-
VCR::Cassette::VALID_RECORD_MODES.each do |mode|
|
47
|
-
VCR::Config.default_cassette_options = nil
|
48
|
-
VCR::Config.default_cassette_record_mode = mode
|
49
|
-
VCR::Config.default_cassette_options[:record].should == mode
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'merges the :record option with the existing default_cassette_record options' do
|
54
|
-
VCR::Config.default_cassette_options = { :an => :option }
|
55
|
-
VCR::Config.default_cassette_record_mode = :all
|
56
|
-
VCR::Config.default_cassette_options.should == { :an => :option, :record => :all }
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'warns the user that it is deprecated' do
|
60
|
-
VCR::Cassette::VALID_RECORD_MODES.each do |mode|
|
61
|
-
VCR::Config.should_receive(:warn).with(%Q{WARNING: #default_cassette_record_mode is deprecated. Instead, use: "default_cassette_options = { :record => :#{mode.to_s} }"})
|
62
|
-
VCR::Config.default_cassette_record_mode = mode
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe "Net::HTTP Response extensions" do
|
4
|
-
context 'extending an already read response' do
|
5
|
-
# disable VCR for this spec...
|
6
|
-
before(:each) { VCR.insert_cassette('response_extension', :allow_real_http => lambda { |uri| true }) }
|
7
|
-
after(:each) { VCR.eject_cassette }
|
8
|
-
|
9
|
-
def self.it_allows_the_body_to_be_read_again
|
10
|
-
let(:expected_regex) { /You have reached this web page by typing.*example\.com/ }
|
11
|
-
|
12
|
-
it 'allows the body to be read using #body' do
|
13
|
-
subject.body.to_s.should =~ expected_regex
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'allows the body to be read using #read_body' do
|
17
|
-
subject.read_body.to_s.should =~ expected_regex
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'allows the body to be read using #read_body with a block' do
|
21
|
-
yielded_body = ''
|
22
|
-
ret_val = subject.read_body { |s| yielded_body << s }
|
23
|
-
yielded_body.should =~ expected_regex
|
24
|
-
ret_val.should be_instance_of(Net::ReadAdapter)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'allows the body to be read by passing a destination string to #read_body' do
|
28
|
-
dest = ''
|
29
|
-
ret_val = subject.read_body(dest)
|
30
|
-
dest.should =~ expected_regex
|
31
|
-
ret_val.should == dest
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'raises an ArgumentError if both a destination string and a block is given to #read_body' do
|
35
|
-
dest = ''
|
36
|
-
expect { subject.read_body(dest) { |s| } }.should raise_error(ArgumentError, 'both arg and block given for HTTP method')
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'raises an IOError when #read_body is called twice with a block' do
|
40
|
-
subject.read_body { |s| }
|
41
|
-
expect { subject.read_body { |s| } }.to raise_error(IOError, /read_body called twice/)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'raises an IOError when #read_body is called twice with a destination string' do
|
45
|
-
dest = ''
|
46
|
-
subject.read_body(dest)
|
47
|
-
expect { subject.read_body(dest) }.to raise_error(IOError, /read_body called twice/)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'when the body has already been read using #read_body and a block' do
|
52
|
-
subject do
|
53
|
-
http = Net::HTTP.new('example.com', 80)
|
54
|
-
response = http.request_get('/') { |res| res.read_body { |s| } }
|
55
|
-
response.extend VCR::Net::HTTPResponse
|
56
|
-
response
|
57
|
-
end
|
58
|
-
|
59
|
-
it_allows_the_body_to_be_read_again
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'when the body has already been read using #read_body and a dest string' do
|
63
|
-
subject do
|
64
|
-
http = Net::HTTP.new('example.com', 80)
|
65
|
-
dest = ''
|
66
|
-
response = http.request_get('/') { |res| res.read_body(dest) }
|
67
|
-
response.extend VCR::Net::HTTPResponse
|
68
|
-
response
|
69
|
-
end
|
70
|
-
|
71
|
-
it_allows_the_body_to_be_read_again
|
72
|
-
end
|
73
|
-
|
74
|
-
context 'when the body has already been read using #body' do
|
75
|
-
subject do
|
76
|
-
http = Net::HTTP.new('example.com', 80)
|
77
|
-
response = http.request_get('/')
|
78
|
-
response.body
|
79
|
-
response.extend VCR::Net::HTTPResponse
|
80
|
-
response
|
81
|
-
end
|
82
|
-
|
83
|
-
it_allows_the_body_to_be_read_again
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe "Net::HTTP Extensions" do
|
4
|
-
before(:each) do
|
5
|
-
VCR.stub!(:current_cassette).and_return(@current_cassette = mock)
|
6
|
-
@uri = URI.parse('http://example.com')
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'works when there is no current cassette' do
|
10
|
-
VCR.stub!(:current_cassette).and_return(nil)
|
11
|
-
lambda { Net::HTTP.get(@uri) }.should_not raise_error
|
12
|
-
end
|
13
|
-
|
14
|
-
context 'when current_cassette.allow_real_http_requests_to? returns false' do
|
15
|
-
before(:each) do
|
16
|
-
@current_cassette.should_receive(:allow_real_http_requests_to?).at_least(:once).with(@uri).and_return(false)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'a request that is not registered with the http stubbing adapter' do
|
20
|
-
before(:each) do
|
21
|
-
VCR.http_stubbing_adapter.should_receive(:request_stubbed?).with(anything, 'http://example.com:80/').and_return(false)
|
22
|
-
end
|
23
|
-
|
24
|
-
def perform_get_with_returning_block
|
25
|
-
Net::HTTP.new('example.com', 80).request(Net::HTTP::Get.new('/', {})) do |response|
|
26
|
-
return response
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'calls #record_http_interaction on the current cassette' do
|
31
|
-
interaction = VCR::HTTPInteraction.new
|
32
|
-
VCR::HTTPInteraction.should_receive(:from_net_http_objects).and_return(interaction)
|
33
|
-
@current_cassette.should_receive(:record_http_interaction).with(interaction)
|
34
|
-
Net::HTTP.get(@uri)
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'calls #record_http_interaction only once, even when Net::HTTP internally recursively calls #request' do
|
38
|
-
@current_cassette.should_receive(:record_http_interaction).once
|
39
|
-
Net::HTTP.new('example.com', 80).post('/', nil)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'calls #record_http_interaction when Net::HTTP#request is called with a block with a return statement' do
|
43
|
-
@current_cassette.should_receive(:record_http_interaction).once
|
44
|
-
perform_get_with_returning_block
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
describe 'a request that is registered with the http stubbing adapter' do
|
49
|
-
it 'does not call #record_http_interaction on the current cassette' do
|
50
|
-
VCR.http_stubbing_adapter.should_receive(:request_stubbed?).with(:get, 'http://example.com:80/').and_return(true)
|
51
|
-
@current_cassette.should_not_receive(:record_http_interaction)
|
52
|
-
Net::HTTP.get(@uri)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context 'when current_cassette.allow_real_http_requests_to? returns true' do
|
58
|
-
before(:each) do
|
59
|
-
@current_cassette.should_receive(:allow_real_http_requests_to?).with(@uri).and_return(true)
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'does not call #record_http_interaction on the current cassette' do
|
63
|
-
@current_cassette.should_receive(:record_http_interaction).never
|
64
|
-
Net::HTTP.get(@uri)
|
65
|
-
end
|
66
|
-
|
67
|
-
it 'uses VCR.http_stubbing_adapter.with_http_connections_allowed_set_to(true) to make the request' do
|
68
|
-
VCR.http_stubbing_adapter.should_receive(:with_http_connections_allowed_set_to).with(true).and_yield
|
69
|
-
Net::HTTP.get(@uri)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
describe 'Net::ReadAdapter extensions' do
|
4
|
-
it 'delegates yaml serialization to the body string' do
|
5
|
-
adapter = Net::ReadAdapter.new(proc { |s| })
|
6
|
-
adapter << 'some text'
|
7
|
-
adapter << ' and some more text'
|
8
|
-
adapter.to_yaml.should == 'some text and some more text'.to_yaml
|
9
|
-
end
|
10
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::RecordedResponse
|
3
|
-
method: :post
|
4
|
-
uri: http://example.com:80/
|
5
|
-
response: !ruby/object:Net::HTTPOK
|
6
|
-
body: The response from example.com
|
7
|
-
body_exist: true
|
8
|
-
code: "200"
|
9
|
-
header:
|
10
|
-
etag:
|
11
|
-
- "\"24ec5-1b6-4059a80bfd280\""
|
12
|
-
last-modified:
|
13
|
-
- Tue, 15 Nov 2005 13:24:10 GMT
|
14
|
-
content-type:
|
15
|
-
- text/html; charset=UTF-8
|
16
|
-
connection:
|
17
|
-
- close
|
18
|
-
server:
|
19
|
-
- Apache/2.2.3 (CentOS)
|
20
|
-
date:
|
21
|
-
- Wed, 31 Mar 2010 02:43:26 GMT
|
22
|
-
content-length:
|
23
|
-
- "438"
|
24
|
-
accept-ranges:
|
25
|
-
- bytes
|
26
|
-
http_version: "1.1"
|
27
|
-
message: OK
|
28
|
-
read: true
|
29
|
-
socket:
|
@@ -1,110 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: http://example.com:80/
|
6
|
-
body:
|
7
|
-
headers:
|
8
|
-
response: !ruby/struct:VCR::Response
|
9
|
-
status: !ruby/struct:VCR::ResponseStatus
|
10
|
-
code: 200
|
11
|
-
message: OK
|
12
|
-
headers:
|
13
|
-
last-modified:
|
14
|
-
- Tue, 15 Nov 2005 13:24:10 GMT
|
15
|
-
connection:
|
16
|
-
- Keep-Alive
|
17
|
-
date:
|
18
|
-
- Thu, 25 Feb 2010 07:52:38 GMT
|
19
|
-
content-type:
|
20
|
-
- text/html; charset=UTF-8
|
21
|
-
etag:
|
22
|
-
- "\"24ec5-1b6-4059a80bfd280\""
|
23
|
-
server:
|
24
|
-
- Apache/2.2.3 (CentOS)
|
25
|
-
content-length:
|
26
|
-
- "438"
|
27
|
-
age:
|
28
|
-
- "3009"
|
29
|
-
accept-ranges:
|
30
|
-
- bytes
|
31
|
-
body: |
|
32
|
-
<HTML>
|
33
|
-
<HEAD>
|
34
|
-
<TITLE>Example Web Page</TITLE>
|
35
|
-
</HEAD>
|
36
|
-
<body>
|
37
|
-
<p>You have reached this web page by typing "example.com",
|
38
|
-
"example.net",
|
39
|
-
or "example.org" into your web browser.</p>
|
40
|
-
<p>These domain names are reserved for use in documentation and are not available
|
41
|
-
for registration. See <a href="http://www.rfc-editor.org/rfc/rfc2606.txt">RFC
|
42
|
-
2606</a>, Section 3.</p>
|
43
|
-
</BODY>
|
44
|
-
</HTML>
|
45
|
-
|
46
|
-
http_version: "1.1"
|
47
|
-
- !ruby/struct:VCR::HTTPInteraction
|
48
|
-
request: !ruby/struct:VCR::Request
|
49
|
-
method: :get
|
50
|
-
uri: http://example.com:80/foo
|
51
|
-
body:
|
52
|
-
headers:
|
53
|
-
response: !ruby/struct:VCR::Response
|
54
|
-
status: !ruby/struct:VCR::ResponseStatus
|
55
|
-
code: 404
|
56
|
-
message: Not Found
|
57
|
-
headers:
|
58
|
-
connection:
|
59
|
-
- close
|
60
|
-
content-type:
|
61
|
-
- text/html; charset=iso-8859-1
|
62
|
-
date:
|
63
|
-
- Thu, 25 Feb 2010 07:52:38 GMT
|
64
|
-
server:
|
65
|
-
- Apache/2.2.3 (CentOS)
|
66
|
-
content-length:
|
67
|
-
- "277"
|
68
|
-
body: |
|
69
|
-
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
70
|
-
<html><head>
|
71
|
-
<title>404 Not Found</title>
|
72
|
-
</head><body>
|
73
|
-
<h1>Not Found</h1>
|
74
|
-
<p>The requested URL /foo was not found on this server.</p>
|
75
|
-
<hr>
|
76
|
-
<address>Apache/2.2.3 (CentOS) Server at example.com Port 80</address>
|
77
|
-
</body></html>
|
78
|
-
|
79
|
-
http_version: "1.1"
|
80
|
-
- !ruby/struct:VCR::HTTPInteraction
|
81
|
-
request: !ruby/struct:VCR::Request
|
82
|
-
method: :get
|
83
|
-
uri: http://example.com:80/
|
84
|
-
body:
|
85
|
-
headers:
|
86
|
-
response: !ruby/struct:VCR::Response
|
87
|
-
status: !ruby/struct:VCR::ResponseStatus
|
88
|
-
code: 200
|
89
|
-
message: OK
|
90
|
-
headers:
|
91
|
-
last-modified:
|
92
|
-
- Tue, 15 Nov 2005 13:24:10 GMT
|
93
|
-
connection:
|
94
|
-
- Keep-Alive
|
95
|
-
date:
|
96
|
-
- Thu, 25 Feb 2010 07:52:38 GMT
|
97
|
-
content-type:
|
98
|
-
- text/html; charset=UTF-8
|
99
|
-
etag:
|
100
|
-
- "\"24ec5-1b6-4059a80bfd280\""
|
101
|
-
server:
|
102
|
-
- Apache/2.2.3 (CentOS)
|
103
|
-
content-length:
|
104
|
-
- "438"
|
105
|
-
age:
|
106
|
-
- "3009"
|
107
|
-
accept-ranges:
|
108
|
-
- bytes
|
109
|
-
body: Another example.com response
|
110
|
-
http_version: "1.1"
|