spec/bogus/stubbing/overwrites_methods_spec.rb in bogus-0.1.4 vs spec/bogus/stubbing/overwrites_methods_spec.rb in bogus-0.1.5

- old
+ new

@@ -22,11 +22,11 @@ before do overwriter.overwrite(object, :greet) end it "does not change the method signature" do - object.method(:greet).arity.should == 1 + expect(object.method(:greet).arity).to eq(1) end it "does not change the method signature" do expect { object.greet("John", "Paul") @@ -34,28 +34,28 @@ end it "adds interaction recording to the overwritten object" do object.greet("John") - object.should Bogus.have_received.greet("John") - object.should_not Bogus.have_received.greet("Paul") + expect(object).to Bogus.have_received.greet("John") + expect(object).not_to Bogus.have_received.greet("Paul") end it "can reset the overwritten methods" do overwriter.reset(object) - object.greet("John").should == "Hello John" + expect(object.greet("John")).to eq("Hello John") end it "is imdepotent when overwriting" do overwriter.overwrite(object, :greet) overwriter.overwrite(object, :greet) overwriter.overwrite(object, :greet) overwriter.reset(object) - object.greet("John").should == "Hello John" + expect(object.greet("John")).to eq("Hello John") end end context "with objects that use method missing" do class UsesMethodMissing @@ -73,29 +73,29 @@ before do overwriter.overwrite(object, :greet) end it "can overwrite the non-existent methods" do - object.methods.should include(:greet) + expect(object.methods).to include(:greet) end it "can be reset back to the original state" do overwriter.overwrite(object, :greet) overwriter.overwrite(object, :greet) overwriter.reset(object) - object.greet.should == "the original return value" + expect(object.greet).to eq("the original return value") end end context "with fakes" do let(:fake) { Samples::FooFake.new } it "does nothing because fakes methods already work as we need" do overwriter.overwrite(fake, :foo_bar) - fake.should_not respond_to(:foo_bar) + expect(fake).not_to respond_to(:foo_bar) end it "does not reset fakes, because there is nothing to reset" do expect { overwriter.reset(fake)