-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbowling.spec
51 lines (38 loc) · 907 Bytes
/
bowling.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'rubygems'
gem 'rspec'
require 'bowling'
describe Game do
it "score be 0 with 0 rolls" do
game = Game.new
game.score().should == 0
end
it "should have 10 frames" do
game = Game.new
game.frames.size.should == 10
end
end
describe Roll do
(1..10).to_a.each do |roll|
it "should be valid if #{roll}" do
roll = Roll.new(roll)
roll.valid?.should == true
end
end
[
-1, 11, 12, 13, 14, 100, 500
].each do |roll|
it "should be invalid if #{roll}" do
roll = Roll.new(roll)
roll.valid?.should == false
end
end
end
describe Frame do
it "should have 1 to 3 rolls"
it "should have a maximum score of 10 if not final frame"
it "should have a maximum score of 20 if final frame"
it "final should be false be default" do
frame = Frame.new
frame.final?.should be_false
end
end