-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwerewolf_test.rb
56 lines (47 loc) · 1.43 KB
/
werewolf_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
gem 'minitest', '~> 5.2'
require 'minitest/autorun'
require 'minitest/pride'
require_relative 'werewolf'
class WerewolfTest < Minitest::Test
def test_it_has_a_name
werewolf = Werewolf.new("David")
assert_equal "David", werewolf.name
end
def test_it_has_a_location
werewolf = Werewolf.new("David","London")
assert_equal "London", werewolf.location
end
def test_it_is_by_default_in_human_form
werewolf = Werewolf.new("David","London")
assert werewolf.human?
end
def test_it_can_change
werewolf = Werewolf.new("David","London")
assert werewolf.respond_to?(:change!)
end
def test_when_starting_as_a_human_changing_means_it_is_no_longer_human
werewolf = Werewolf.new("David","London")
werewolf.change!
refute werewolf.human?
end
def test_when_starting_as_a_human_changing_turns_it_into_a_werewolf
werewolf = Werewolf.new("David","London")
werewolf.change!
assert werewolf.werewolf?
end
def test_when_starting_as_a_human_changing_a_second_time_it_becomes_human_again
werewolf = Werewolf.new("David","London")
assert werewolf.human?
werewolf.change!
werewolf.change!
assert werewolf.human?
end
def test_when_starting_as_a_werewolf_changing_a_second_time_it_becomes_werewolf_again
werewolf = Werewolf.new("David","London")
werewolf.change!
assert werewolf.werewolf?
werewolf.change!
werewolf.change!
assert werewolf.werewolf?
end
end