spec/bogus/contracts/verifies_contracts_spec.rb in bogus-0.1.5 vs spec/bogus/contracts/verifies_contracts_spec.rb in bogus-0.1.6
- old
+ new
@@ -1,33 +1,33 @@
require 'spec_helper'
describe Bogus::VerifiesContracts do
- let(:real_interactions) { stub }
- let(:doubled_interactions) { stub }
+ let(:real_interactions) { double }
+ let(:doubled_interactions) { double }
let(:verifies_contracts) { isolate(Bogus::VerifiesContracts) }
let(:matched_interaction) { interaction("matched") }
it "fails unmatched calls" do
first_interaction = interaction("first")
second_interaction = interaction("second")
other_interaction = interaction("other")
- stub(doubled_interactions).for_fake(:fake_name){[first_interaction, matched_interaction, second_interaction]}
- stub(real_interactions).for_fake(:fake_name){[matched_interaction, other_interaction]}
+ allow(doubled_interactions).to receive(:for_fake).with(:fake_name){[first_interaction, matched_interaction, second_interaction]}
+ allow(real_interactions).to receive(:for_fake).with(:fake_name){[matched_interaction, other_interaction]}
- stub(real_interactions).recorded?(:fake_name, first_interaction) { false }
- stub(real_interactions).recorded?(:fake_name, second_interaction) { false }
- stub(real_interactions).recorded?(:fake_name, matched_interaction) { true }
+ allow(real_interactions).to receive(:recorded?).with(:fake_name, first_interaction) { false }
+ allow(real_interactions).to receive(:recorded?).with(:fake_name, second_interaction) { false }
+ allow(real_interactions).to receive(:recorded?).with(:fake_name, matched_interaction) { true }
expect_verify_to_raise_error_with_interactions(:fake_name,
[first_interaction, second_interaction],
[matched_interaction, other_interaction])
end
it "passes with all calls matched" do
- stub(doubled_interactions).for_fake(:fake_name) { [matched_interaction] }
- stub(real_interactions).recorded?(:fake_name, matched_interaction) { true }
+ allow(doubled_interactions).to receive(:for_fake).with(:fake_name) { [matched_interaction] }
+ allow(real_interactions).to receive(:recorded?).with(:fake_name, matched_interaction) { true }
expect {
verifies_contracts.verify(:fake_name)
}.not_to raise_error
end