Skip to content

Instantly share code, notes, and snippets.

@caioertai
Created January 25, 2019 02:16
Show Gist options
  • Save caioertai/bb0db133093e61fc5a493938903bb6bf to your computer and use it in GitHub Desktop.
Save caioertai/bb0db133093e61fc5a493938903bb6bf to your computer and use it in GitHub Desktop.
def acronymize(sentence)
sentence.split.map { |word| word[0].upcase }.join
end
p acronymize('frequently asked questions')
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