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:
parent
1cc1cf4b28
commit
ed89156612
2 changed files with 6 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'}) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue