-
Notifications
You must be signed in to change notification settings - Fork 0
/
2.rb
38 lines (29 loc) · 908 Bytes
/
2.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
require 'minitest/autorun'
class Player
end
class Team
end
class TeamTests < Minitest::Test
def test_players_have_salaries
messi = Player.new "Messi", "Lionel", 20
assert_equal 20, messi.salary
end
def test_players_have_names
ronaldo = Player.new "Ronaldo", "Cristiano", 17
assert_equal "Cristiano Ronaldo", ronaldo.name
end
def test_teams_can_sign_players
barcelona = Team.new "Barcelona", 100
assert_equal 0, barcelona.team_size
barcelona.sign Player.new("Messi", "Lionel", 20)
barcelona.sign Player.new("Suárez", "Luis", 10.4)
assert_equal 2, barcelona.team_size
end
def test_teams_have_a_budget
barcelona = Team.new "Barcelona", 100
assert_equal 100, barcelona.budget_left
barcelona.sign Player.new("Messi", "Lionel", 20)
barcelona.sign Player.new("Suárez", "Luis", 10.4)
assert_equal 69.6, barcelona.budget_left
end
end