-
Notifications
You must be signed in to change notification settings - Fork 0
/
wizard_test.rb
56 lines (46 loc) · 1.26 KB
/
wizard_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 'wizard'
class WizardTest < Minitest::Test
def test_has_name
wizard = Wizard.new("Eric")
assert_equal "Eric", wizard.name
end
def test_can_have_different_name
wizard = Wizard.new("Alex")
assert_equal "Alex", wizard.name
end
def test_is_bearded_by_default
wizard = Wizard.new("Ben")
assert wizard.bearded?
end
def test_is_not_always_bearded
wizard = Wizard.new("Valerie", bearded: false)
refute wizard.bearded?
end
def test_has_root_powers
wizard = Wizard.new("Sarah", bearded: false)
assert_equal "sudo chown ~/bin", wizard.incantation("chown ~/bin")
end
def test_has_lots_of_root_powers
wizard = Wizard.new("Rob", bearded: false)
assert_equal "sudo rm -rf /home/mirandax", wizard.incantation("rm -rf /home/mirandax")
end
def test_starts_rested
wizard = Wizard.new('Timo')
assert wizard.rested?
end
def test_can_cast_spells
wizard = Wizard.new('Merlin')
assert_equal "MAGIC MISSILE!", wizard.cast
end
def test_gets_tired_after_casting_three_spells
wizard = Wizard.new('Arya')
wizard.cast
wizard.cast
assert wizard.rested?
wizard.cast
refute wizard.rested?
end
end