Sha256: e325a9ceb2c3b685b9fb9e21973049f632dfdd9d2cab520b99bb78efe4dd304d
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
require "spec_helper" describe "Frozen Fakes" do before do extend Bogus::MockingDSL end class ExampleForFreezing def foo(x) end end shared_examples_for "frozen fakes" do before { object.freeze } describe "stubbing" do it "allows stubbing" do stub(object).foo(1) { 123 } expect(object.foo(1)).to eq 123 end end describe "mocking" do it "allows mocking" do mock(object).foo(1) { 123 } expect(object.foo(1)).to eq 123 end it "allows verifying expectations" do mock(object).foo(1) { 123 } expect { Bogus.after_each_test }.to raise_error(Bogus::NotAllExpectationsSatisfied) end end describe "spying" do it "allows spying" do object.foo(1) expect(object).to have_received.foo(1) expect(object).to_not have_received.foo(2) end end end context "anonymous fakes" do let(:object) { fake } include_examples "frozen fakes" end context "named fakes" do let(:object) { fake(:example_for_freezing) } include_examples "frozen fakes" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bogus-0.1.7 | spec/bogus/fakes/frozen_fakes_spec.rb |
bogus-0.1.6 | spec/bogus/fakes/frozen_fakes_spec.rb |