-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasketball_players_spec.rb
67 lines (52 loc) · 1.63 KB
/
basketball_players_spec.rb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
require_relative 'basketball_players'
describe Basketball_player do
before do
@initial_points = 7
@basketball_player = Basketball_player.new("Derreck Rose", @initial_points)
end
it "has a capitalized title " do
@basketball_player.player.should == "Derreck rose"
end
it "has initial points given" do
@basketball_player.points.should == 7
end
it "has a string representation to_s" do
@basketball_player.to_s.should == " Derreck rose had 7 fantasy points (Bad Game)"
end
it "increased rank by 1 when given good_game" do
@basketball_player.good_game
@basketball_player.points.should == @initial_points + 1
end
it "decreased rank by 1 when given bad_game" do
@basketball_player.bad_game
@basketball_player.points.should == @initial_points - 1
end
context "created with a deafualt point" do
before do
@basketball_player = Basketball_player.new("Derrick Rose")
end
it "has a rank of 7" do
@basketball_player.points.should == 6
end
end
context "with a rank of at least 10" do
before do
@basketball_player = Basketball_player.new("Kevin Durrant", 11)
end
it " is an allstar" do
@basketball_player.should be_allstar
end
it " having a great game" do
@basketball_player.status.should == "Great Game"
end
end
context "with rank of less than 8" do
@basketball_player = Basketball_player.new("Derreck Rose", 7 )
end
it " is not an allstar" do
@basketball_player.should_not be_allstar
end
it "having a bad game" do
@basketball_player.status.should == "Bad Game"
end
end