-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpirate_test.rb
42 lines (36 loc) · 981 Bytes
/
pirate_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
gem 'minitest', '~> 5.2'
require 'minitest/autorun'
require 'minitest/pride'
require_relative 'pirate'
class PirateTest < Minitest::Test
def test_has_name
pirate = Pirate.new("Jack")
assert_equal "Jack", pirate.name
end
def test_can_have_different_name
pirate = Pirate.new("Blackbeard")
assert_equal "Blackbeard", pirate.name
end
def test_is_a_scallywag_by_default
pirate = Pirate.new("Jack")
assert_equal 'Scallywag', pirate.job
end
def test_in_not_always_a_scallywag
pirate = Pirate.new("Jack", "Cook")
assert_equal "Cook", pirate.job
end
def test_isnt_cursed_by_default
pirate = Pirate.new("Jack")
refute pirate.cursed?
end
def test_becomes_cursed_after_enough_heinous_acts
pirate = Pirate.new("Jack")
refute pirate.cursed?
pirate.commit_heinous_act
refute pirate.cursed?
pirate.commit_heinous_act
refute pirate.cursed?
pirate.commit_heinous_act
assert pirate.cursed?
end
end