features/fakes/anonymous_doubles.feature in bogus-0.1.0 vs features/fakes/anonymous_doubles.feature in bogus-0.1.1
- old
+ new
@@ -16,11 +16,11 @@
factory = fake()
stub(factory).make_validator{ proc{ false } }
Background:
- Given a file named "foo.rb" with:
+ Given a file named "student.rb" with:
"""ruby
class Student
attr_reader :library_card
def initialize(name)
@@ -34,10 +34,12 @@
"""
Scenario: Stubbing any method with any parameters
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+
describe Student do
let(:library) { fake }
let(:jake) { Student.new("Jake") }
it "allows stubbing any method with any parameters" do
@@ -51,10 +53,12 @@
"""
Scenario: Stubbing methods in initializer
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+
describe Student do
let(:library) { fake(register_junior: "the card") }
let(:jake) { Student.new("Jake") }
it "allows stubbing any method with any parameters" do
@@ -75,10 +79,12 @@
"""
Scenario: Mocking any method with any parameters
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+
describe Student do
let(:library) { fake }
let(:jake) { Student.new("Jake") }
it "allows mocking any method with any parameters" do
@@ -92,10 +98,12 @@
"""
Scenario: Mocking any method with any parameters
Then spec file with following content should fail:
"""ruby
+ require_relative 'student'
+
describe Student do
it "allows stubbing any method with any parameters" do
library = fake
mock(library).register_junior { "the card" }
end
@@ -103,10 +111,12 @@
"""
Scenario: Stubbing methods in initializer
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+
describe Student do
let(:library) { fake(register_junior: "the card") }
let(:jake) { Student.new("Jake") }
it "allows stubbing any method with any parameters" do
@@ -118,10 +128,12 @@
"""
Scenario: Spying on method calls
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+
describe Student do
let(:library) { fake }
let(:jake) { Student.new("Jake") }
it "allows spying on any method" do
@@ -133,9 +145,11 @@
"""
Scenario: Invoking arbitrary methods
Then spec file with following content should pass:
"""ruby
+ require_relative 'student'
+
describe Student do
let(:library) { fake }
it "allows calling any method with any parameters" do
expect {