features/fakes/fake_objects.feature in bogus-0.1.4 vs features/fakes/fake_objects.feature in bogus-0.1.5

- old
+ new

@@ -58,11 +58,11 @@ describe Student do fake(:library) it "does something" do - Student.learn(library).should be_true + expect(Student.learn(library)).to be_true end end """ Scenario: Taking the guesswork out of finding a class to copy @@ -75,11 +75,11 @@ describe "logger fake" do fake(:library) { PublicLibrary } it "uses the class provided in block instead of the guessed one" do - library.class.name.should == "PublicLibrary" + expect(library.class.name).to eq("PublicLibrary") end end """ Scenario: Fakes which are classes @@ -89,15 +89,15 @@ describe "library class fake" do fake(:library, as: :class) it "is a class" do - library.should be_a(Class) + expect(library).to be_a(Class) end it "has the same name as original class" do - library.name.should == Library.name + expect(library.name).to eq(Library.name) end it "has same methods as original class" do library.look_up('something') end @@ -112,12 +112,35 @@ describe "library class fake" do let(:library) { fake(:library, checkout: "checked out", return_book: "returned") } it "sets the default return value for provided functions" do - library.checkout("Moby Dick").should == "checked out" - library.checkout("Three Musketeers").should == "checked out" - library.return_book("Moby Dick").should == "returned" - library.return_book("Three Musketeers").should == "returned" + expect(library.checkout("Moby Dick")).to eq("checked out") + expect(library.checkout("Three Musketeers")).to eq("checked out") + expect(library.return_book("Moby Dick")).to eq("returned") + expect(library.return_book("Three Musketeers")).to eq("returned") + end + end + """ + + Scenario: Fakes are identified as instances of the faked class + Then spec file with following content should pass: + """ruby + require_relative 'library' + + def library?(object) + case object + when Library + true + else + false + end + end + + describe "library class fake" do + fake(:library) + + it "is identified as Library" do + expect(library?(library)).to be_true end end """