From 790d354c8826d2c2fabc3524478f81099291f441 Mon Sep 17 00:00:00 2001 From: Bobby McDonald Date: Mon, 2 Mar 2020 15:07:25 -0500 Subject: [PATCH] OmniAuth::Utils.camelize now properly handles passing false param --- lib/omniauth.rb | 2 +- spec/omniauth_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/omniauth.rb b/lib/omniauth.rb index dc315ee..f9cfaf8 100644 --- a/lib/omniauth.rb +++ b/lib/omniauth.rb @@ -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 diff --git a/spec/omniauth_spec.rb b/spec/omniauth_spec.rb index 12f3161..8013ccb 100644 --- a/spec/omniauth_spec.rb +++ b/spec/omniauth_spec.rb @@ -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