OmniAuth::Utils.camelize now properly handles passing false param

This commit is contained in:
Bobby McDonald 2020-03-02 15:07:25 -05:00
parent fce9e23dd4
commit 790d354c88
No known key found for this signature in database
GPG Key ID: CAD931A49619329A
2 changed files with 5 additions and 1 deletions

View File

@ -159,7 +159,7 @@ module OmniAuth
if first_letter_in_uppercase
word.to_s.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
else
word.first + camelize(word)[1..-1]
camelize(word).tap { |w| w[0] = w[0].downcase }
end
end
end

View File

@ -148,6 +148,10 @@ describe OmniAuth do
OmniAuth.config.add_camelization('oauth', 'OAuth')
expect(OmniAuth::Utils.camelize(:oauth)).to eq('OAuth')
end
it 'doesn\'t uppercase the first letter when passed false' do
expect(OmniAuth::Utils.camelize('apple_jack', false)).to eq('appleJack')
end
end
end
end