features/fakes/fake_objects.feature in bogus-0.1.0 vs features/fakes/fake_objects.feature in bogus-0.1.1
- old
+ new
@@ -24,11 +24,11 @@
Which is equivalent to:
let(:foo) { fake(:foo, bar: "value") }
Background:
- Given a file named "foo.rb" with:
+ Given a file named "library.rb" with:
"""ruby
class Library
def checkout(book)
end
@@ -36,11 +36,14 @@
end
def self.look_up(book)
end
end
+ """
+ Given a file named "student.rb" with:
+ """ruby
class Student
def self.learn(library = Library.new)
library.checkout("hello world")
true
end
@@ -48,10 +51,13 @@
"""
Scenario: Calling methods that exist on real object
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+ require_relative 'library'
+
describe Student do
fake(:library)
it "does something" do
Student.learn(library).should be_true
@@ -77,10 +83,12 @@
"""
Scenario: Fakes which are classes
Then spec file with following content should pass:
"""ruby
+ require_relative 'library'
+
describe "library class fake" do
fake(:library, as: :class)
it "is a class" do
library.should be_a(Class)
@@ -97,9 +105,11 @@
"""
Scenario: Fakes with inline return values
Then spec file with following content should pass:
"""ruby
+ require_relative 'library'
+
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