Last active
January 4, 2016 03:19
-
-
Save laser/8560948 to your computer and use it in GitHub Desktop.
foo.rb spec - with bug
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 '../foo' | |
describe StatefulCalculator do | |
before(:all) do | |
@subject = StatefulCalculator.new | |
end | |
it 'should add some numbers' do | |
expect(@subject.add(5).add(3).add(10).result).to eq(18) | |
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
require_relative '../foo' | |
describe StatefulCalculator do | |
before(:all) do | |
@subject = StatefulCalculator.new | |
end | |
it 'should add some numbers' do | |
expect(@subject.add(5).add(3).add(10).result).to eq(18) | |
end | |
it 'should divide some numbers' do | |
expect(@subject.add(10).div(2).result).to eq(5) # Failure! Expected 5 and got 14 | |
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
describe StatelessCalculator do | |
it 'should add some numbers' do | |
expect(StatelessCalculator.add(10, StatelessCalculator.add(5, 3))).to eq(18) | |
end | |
it 'should divide some numbers' do | |
expect(StatelessCalculator.div(10, 2)).to eq(5) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment