OmniAuth::Utils.camelize now properly handles passing false param
This commit is contained in:
parent
fce9e23dd4
commit
790d354c88
|
@ -159,7 +159,7 @@ module OmniAuth
|
||||||
if first_letter_in_uppercase
|
if first_letter_in_uppercase
|
||||||
word.to_s.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
|
word.to_s.gsub(%r{/(.?)}) { '::' + Regexp.last_match[1].upcase }.gsub(/(^|_)(.)/) { Regexp.last_match[2].upcase }
|
||||||
else
|
else
|
||||||
word.first + camelize(word)[1..-1]
|
camelize(word).tap { |w| w[0] = w[0].downcase }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -148,6 +148,10 @@ describe OmniAuth do
|
||||||
OmniAuth.config.add_camelization('oauth', 'OAuth')
|
OmniAuth.config.add_camelization('oauth', 'OAuth')
|
||||||
expect(OmniAuth::Utils.camelize(:oauth)).to eq('OAuth')
|
expect(OmniAuth::Utils.camelize(:oauth)).to eq('OAuth')
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue