Created
January 25, 2019 02:16
-
-
Save caioertai/bb0db133093e61fc5a493938903bb6bf 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
def acronymize(sentence) | |
sentence.split.map { |word| word[0].upcase }.join | |
end | |
p acronymize('frequently asked questions') |
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
require_relative './acronymize.rb' | |
describe '#acronymize' do | |
it 'it returns an string if given an empty' do | |
sentence = '' | |
expected = '' | |
actual = acronymize(sentence) | |
expect(actual).to eq(expected) | |
end | |
it 'it returns FAQ if given frequently asked questions' do | |
sentence = 'frequently asked questions' | |
expected = 'FAQ' | |
actual = acronymize(sentence) | |
expect(actual).to eq(expected) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment