-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaffeine.rb
52 lines (35 loc) · 1.04 KB
/
caffeine.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
require 'minitest/autorun'
require 'pry'
require './human.rb'
require './coffee.rb'
## This assignment made more sense when I wrote it in the morning.
class CaffeineTest < MiniTest::Test
def test_humans_tend_to_be_sleepy
tyler = Human.new "Tyler"
assert tyler.alertness < 0.1
end
def test_humans_need_coffee
randy = Human.new "Randy"
refute randy.has_coffee?
assert randy.needs_coffee?
end
def test_humans_can_drink_coffee
sherri = Human.new "Sherri"
tsmf = Coffee.new "Triple Shot Mocha Frappuccino"
assert tsmf.full? ###############
sherri.buy tsmf
sherri.drink!
assert_in_epsilon sherri.alertness, 0.33, 0.1
refute tsmf.full?
refute tsmf.empty?
end
def test_humans_can_drink_all_the_coffee
trevor = Human.new "Trevor"
tsmf = Coffee.new "Triple Shot Mocha Frappuccino"
trevor.buy tsmf
3.times { trevor.drink! }
assert tsmf.empty? ###############
assert trevor.alertness > 0.9
end
# binding.pry
end