forked from turingschool/enums-exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_first_one_test.rb
49 lines (39 loc) · 1020 Bytes
/
find_first_one_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
gem 'minitest'
require 'minitest'
require 'minitest/pride'
class FindFirstOneTest < Minitest::Test
Thing = Struct.new(:adjective) do
def weird?
adjective == 'weird'
end
end
def test_first_thing
thing1 = Thing.new('odd')
thing2 = Thing.new('cool')
thing3 = Thing.new('weird')
thing4 = Thing.new('fun')
thing5 = Thing.new('weird')
things = [thing1, thing2, thing3, thing4, thing5]
found = nil
things.each do |thing|
# write code here
end
assert_equal thing3.object_id, found.object_id
end
Unicorn = Struct.new(:color) do
def pink?
color == 'pink'
end
end
def test_first_pink_unicorn
skip
unicorn1 = Unicorn.new('white')
unicorn2 = Unicorn.new('sparkly')
unicorn3 = Unicorn.new('purple')
unicorn4 = Unicorn.new('pink')
unicorn5 = Unicorn.new('pink')
unicorns = [unicorn1, unicorn2, unicorn3, unicorn4, unicorn5]
# write code here
assert_equal unicorn4.object_id, found.object_id
end
end