-
Notifications
You must be signed in to change notification settings - Fork 0
/
medusa_test.rb
69 lines (56 loc) · 1.67 KB
/
medusa_test.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
67
68
69
gem 'minitest', '~> 5.2'
require 'minitest/autorun'
require 'minitest/pride'
require_relative 'medusa'
class MedusaTest < Minitest::Test
def test_it_has_a_name
medusa = Medusa.new("Cassiopeia")
assert_equal "Cassiopeia", medusa.name
end
def test_when_first_created_she_has_no_statues
medusa = Medusa.new("Cassiopeia")
assert medusa.statues.empty?
end
def test_when_staring_at_a_person_she_gains_a_statue
medusa = Medusa.new("Cassiopeia")
victim = Person.new("Perseus")
medusa.stare(victim)
assert_equal 1, medusa.statues.count
assert_equal "Perseus", medusa.statues.first.name
end
def test_when_staring_at_a_person_that_person_turns_to_stone
medusa = Medusa.new("Cassiopeia")
victim = Person.new("Perseus")
refute victim.stoned?
medusa.stare(victim)
assert victim.stoned?
end
def test_can_only_have_three_victims
medusa = Medusa.new("Cassiopeia")
victim = Person.new("Perseus")
victim_2 = Person.new("Timo")
victim_3 = Person.new("K")
victim_4 = Person.new("i")
medusa.stare(victim)
medusa.stare(victim_2)
medusa.stare(victim_3)
medusa.stare(victim_4)
medusa.victim_limit
assert_equal 3, medusa.statues.length
end
def test_if_a_fourth_victim_is_stoned_first_is_unstoned
medusa = Medusa.new("Cassiopeia")
victim = Person.new("Perseus")
victim_2 = Person.new("Timo")
victim_3 = Person.new("K")
victim_4 = Person.new("i")
medusa.stare(victim)
medusa.stare(victim_2)
medusa.stare(victim_3)
medusa.stare(victim_4)
medusa.victim_limit
assert_equal 3, medusa.statues.length
refute victim.stoned?
assert victim_4.stoned?
end
end