1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Update AuthHash#regular_writer to ensure that #info is a Hash

This commit is contained in:
Eugene 2016-05-24 03:01:42 +03:00
parent 1cc1cf4b28
commit ed89156612
2 changed files with 6 additions and 1 deletions

View file

@ -20,7 +20,7 @@ module OmniAuth
end
def regular_writer(key, value)
if key.to_s == 'info' && !value.is_a?(InfoHash)
if key.to_s == 'info' && value.is_a?(::Hash) && !value.is_a?(InfoHash)
value = InfoHash.new(value)
end
super

View file

@ -8,6 +8,11 @@ describe OmniAuth::AuthHash do
expect(subject.info.first_name).to eq('Awesome')
end
it 'does not try to parse `string` as InfoHash' do
subject.weird_field = { info: 'string' }
expect(subject.weird_field.info).to eq 'string'
end
describe '#valid?' do
subject { OmniAuth::AuthHash.new(:uid => '123', :provider => 'example', :info => {:name => 'Steven'}) }