-
-
Save ecmendenhall/f982da1c0c698f0fbbc8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '0_parent_child' | |
require 'rspec' | |
describe ParentClass do | |
it 'creates a child class' do | |
expect(described_class.new.create_child_class).to be_a(ChildClass) | |
end | |
end | |
describe ChildClass do | |
it 'does something' do | |
expect(described_class.new.do_something).to eq(42 * 80) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentClass | |
def create_child_class | |
childClass = ChildClass.new | |
end | |
end | |
class ChildClass | |
def do_something | |
42 * 80 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/P/R/test_example ❯❯❯ rspec 0_parent_child_spec.rb | |
.. | |
Finished in 0.00136 seconds (files took 0.08179 seconds to load) | |
2 examples, 0 failures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '1_parent_child' | |
require 'rspec' | |
describe ParentClass do | |
it 'creates a child class' do | |
expect(described_class.new.create_child_class).to be_a(ChildClass) | |
end | |
end | |
describe ChildClass do | |
it 'does something' do | |
expect(described_class.new(42).do_something).to eq(42 * 80) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/P/R/test_example ❯❯❯ rspec 1_parent_child_spec.rb | |
.F | |
Failures: | |
1) ChildClass does something | |
Failure/Error: expect(described_class.new(42).do_something).to eq(42 * 80) | |
ArgumentError: | |
wrong number of arguments (1 for 0) | |
# ./1_parent_child_spec.rb:15:in `initialize' | |
# ./1_parent_child_spec.rb:15:in `new' | |
# ./1_parent_child_spec.rb:15:in `block (2 levels) in <top (required)>' | |
Finished in 0.00075 seconds (files took 0.08221 seconds to load) | |
2 examples, 1 failure | |
Failed examples: | |
rspec ./1_parent_child_spec.rb:14 # ChildClass does something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentClass | |
def create_child_class | |
childClass = ChildClass.new | |
end | |
end | |
class ChildClass | |
def initialize(some_parameter) | |
end | |
def do_something | |
42 * 80 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/P/R/test_example ❯❯❯ rspec 1_parent_child_spec.rb | |
F. | |
Failures: | |
1) ParentClass creates a child class | |
Failure/Error: expect(described_class.new.create_child_class).to be_a(ChildClass) | |
ArgumentError: | |
wrong number of arguments (0 for 1) | |
# ./1_parent_child.rb:9:in `initialize' | |
# ./1_parent_child.rb:3:in `new' | |
# ./1_parent_child.rb:3:in `create_child_class' | |
# ./1_parent_child_spec.rb:7:in `block (2 levels) in <top (required)>' | |
Finished in 0.00088 seconds (files took 0.10206 seconds to load) | |
2 examples, 1 failure | |
Failed examples: | |
rspec ./1_parent_child_spec.rb:6 # ParentClass creates a child class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParentClass | |
def create_child_class | |
childClass = ChildClass.new(nil) | |
end | |
end | |
class ChildClass | |
def initialize(some_parameter) | |
end | |
def do_something | |
42 * 80 | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/P/R/test_example ❯❯❯ rspec 1_parent_child_spec.rb | |
.. | |
Finished in 0.00102 seconds (files took 0.08399 seconds to load) | |
2 examples, 0 failures |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative '1_parent_child' | |
require 'rspec' | |
describe ParentClass do | |
it 'creates a child class' do | |
expect(described_class.new.create_child_class).to be_a(ChildClass) | |
end | |
end | |
describe ChildClass do | |
it 'does something' do | |
expect(described_class.new(37).do_something).to eq(37 * 80) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/P/R/test_example ❯❯❯ rspec 1_parent_child_spec.rb | |
.F | |
Failures: | |
1) ChildClass does something | |
Failure/Error: expect(described_class.new(37).do_something).to eq(37 * 80) | |
expected: 2960 | |
got: 3360 | |
(compared using ==) | |
# ./1_parent_child_spec.rb:15:in `block (2 levels) in <top (required)>' | |
Finished in 0.00109 seconds (files took 0.08437 seconds to load) | |
2 examples, 1 failure | |
Failed examples: | |
rspec ./1_parent_child_spec.rb:14 # ChildClass does something |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment