Skip to content

Instantly share code, notes, and snippets.

@laser
Last active January 4, 2016 03:19
Show Gist options
  • Save laser/8560948 to your computer and use it in GitHub Desktop.
Save laser/8560948 to your computer and use it in GitHub Desktop.
foo.rb spec - with bug
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
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
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