Skip to content

Commit

Permalink
Split one spec into many.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Nov 27, 2010
1 parent b58808d commit 2c207cf
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions spec/support/http_library_adapters.rb
Expand Up @@ -208,19 +208,46 @@ def self.test_real_http_request(http_allowed)
get_body_string(make_http_request(:get, url)).should == 'FOO!'
end

it 'records new http requests' do
VCR.should_receive(:record_http_interaction) do |interaction|
interaction.request.uri.should == url
interaction.request.method.should == :get
interaction.response.status.code.should == 200
interaction.response.status.message.should == 'OK'
interaction.response.body.should == 'FOO!'
interaction.response.headers['content-type'].should == ["text/html;charset=utf-8"]
describe 'recording new http requests' do
let(:recorded_interaction) do
interaction = nil
VCR.should_receive(:record_http_interaction) { |i| interaction = i }
make_http_request(:get, url)
interaction
end

make_http_request(:get, url)
end
it 'records the request uri' do
recorded_interaction.request.uri.should == url
end

it 'records the request method' do
recorded_interaction.request.method.should == :get
end

it 'records the request body' do
recorded_interaction.request.body.should be_nil
end

it 'records the request headers' do
recorded_interaction.request.headers.should be_nil
end

it 'records the response status code' do
recorded_interaction.response.status.code.should == 200
end

it 'records the response status message' do
recorded_interaction.response.status.message.should == 'OK'
end

it 'records the response body' do
recorded_interaction.response.body.should == 'FOO!'
end

it 'records the response headers' do
recorded_interaction.response.headers['content-type'].should == ["text/html;charset=utf-8"]
end
end
else
it 'does not allow real HTTP requests or record them' do
VCR.should_receive(:record_http_interaction).never
Expand Down

0 comments on commit 2c207cf

Please sign in to comment.