-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.rb
46 lines (31 loc) · 1.18 KB
/
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
require 'minitest/autorun'
require 'pry'
require "./listanalyzer"
class ListAnalyzer
end
class ListTest < MiniTest::Test
def test_it_can_count_vowels
produce = ["apricot", "beet", "clementine", "date", "elderberry"]
lister = ListAnalyzer.new
assert_equal 2, lister.number_of_words_starting_with_a_vowel(produce)
end
def test_it_can_check_a_whole_list_for_matches
mostly_vowels = ["iceberg", "ugli", "endive", "plum", "olive"]
lister = ListAnalyzer.new
refute lister.all_words_start_with_vowels?(mostly_vowels)
mostly_vowels.delete "plum"
assert lister.all_words_start_with_vowels?(mostly_vowels)
end
def test_it_can_check_for_a_single_example
mostly_consonants = ["pear", "quince", "aubergine", "zucchini", "pineapple"]
lister = ListAnalyzer.new
assert lister.some_word_starts_with_a_vowel?(mostly_consonants)
mostly_consonants.delete "aubergine"
refute lister.some_word_starts_with_a_vowel?(mostly_consonants)
end
def test_it_can_count_all_vowels
produce = ["apricot", "beet", "clementine", "date", "elderberry"]
lister = ListAnalyzer.new
assert_equal 14, lister.number_of_vowels_in_all_words(produce)
end
end