-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedusa_test.rb
47 lines (36 loc) · 1.05 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
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_can_stare
medusa = Medusa.new("Cassiopeia")
assert medusa.respond_to?(:stare)
end
def test_has_statues
medusa = Medusa.new("Cassiopeia")
assert medusa.respond_to?(:statues)
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
end