-
-
Save RickArora/0157b604d7bae787c1a287b9801ac912 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define a method that accepts an array of words and returns an array of those | |
# words whose vowels appear in order. You may wish to write a helper method: | |
# ordered_vowel_word? | |
def ordered_vowel_words(words) | |
array_with_vowels_in_order = words.select { |word| ordered_vowel_word?(word) } | |
end | |
def ordered_vowel_word?(word) | |
vowel_list = "a i e o u".split | |
order_of_vowels = word.split('').select {|word_eval| vowel_list.include?(word_eval)} | |
return order_of_vowels == vowel_list | |
end | |
Failing tests below this line: | |
Enumerables part 1 ordered_vowel_words returns words with no vowels | |
Failure/Error: expect(ordered_vowel_words(words)).to include("pry") | |
expected [] to include "pry" | |
# ./spec/enumerables1_spec.rb:78:in `block (3 levels) in <top (required)>' | |
2) Enumerables part 1 ordered_vowel_words filters out words with out-or-order vowels | |
Failure/Error: expect(ordered_vowel_words(words)).to eq(ordered_words) | |
expected: ["word", "pale", "word", "random", "pry"] | |
got: [] | |
(compared using ==) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment