-
-
Save mcsuth/6786986 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 './bowling' | |
| describe Bowling do | |
| describe '#score' do | |
| let(:game) { Bowling.new } | |
| it 'should start at 0' do | |
| game.score.should == 0 | |
| end | |
| it 'should be 300 for a perfect score' do | |
| 12.times{ game.roll(10) } | |
| game.score.should == 300 | |
| end | |
| it 'should be 5 if my first roll is a 5' do | |
| game.roll(5) | |
| game.score.should == 5 | |
| end | |
| it 'shoud be 10 if my first frame is a spare' do | |
| 2.times { game.roll(5) } | |
| game.score.should == 10 | |
| end | |
| it 'should be 20 if I roll three fives to start' do | |
| 3.times { game.roll(5) } | |
| game.score.should == 20 | |
| end | |
| it 'should be 28 if I roll 10, 5, 4 to start' do | |
| game.roll(10) | |
| game.roll(5) | |
| game.roll(4) | |
| game.score.should == 28 | |
| end | |
| it 'should throw an error if you hit more than 10 pins in a frame' do | |
| expect { | |
| game.roll(7) | |
| game.roll(7) | |
| }.to raise_exception(CheaterException) | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment