Skip to content

Commit

Permalink
Deep structural stubs are a problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
myronmarston committed Feb 11, 2012
1 parent 4eca724 commit a973773
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions spec/vcr/cassette_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ def http_interaction

describe "#serializable_hash" do
subject { VCR::Cassette.new("foo") }
let(:interactions) do [
stub(:to_hash => { "i" => 1 }, :hook_aware => stub(:ignored? => false), :request => stub(:method => :get).as_null_object).as_null_object,
stub(:to_hash => { "i" => 2 }, :hook_aware => stub(:ignored? => false), :request => stub(:method => :get).as_null_object).as_null_object
] end
let(:interaction_1) { http_interaction { |i| i.request.body = 'req body 1'; i.response.body = 'res body 1' } }
let(:interaction_2) { http_interaction { |i| i.request.body = 'req body 2'; i.response.body = 'res body 2' } }
let(:interactions) { [interaction_1, interaction_2] }

before(:each) do
interactions.each do |i|
Expand All @@ -80,7 +79,9 @@ def http_interaction
let(:metadata) { subject.serializable_hash.reject { |k,v| k == "http_interactions" } }

it 'includes the hash form of all recorded interactions' do
subject.serializable_hash.should include('http_interactions' => [{ "i" => 1 }, { "i" => 2 }])
interaction_1.stub(:to_hash => { "i" => 1, 'body' => '' })
interaction_2.stub(:to_hash => { "i" => 2, 'body' => '' })
subject.serializable_hash.should include('http_interactions' => [{ "i" => 1, 'body' => '' }, { "i" => 2, 'body' => '' }])
end

it 'includes additional metadata about the cassette' do
Expand Down

0 comments on commit a973773

Please sign in to comment.