Skip to content

Commit

Permalink
Merge pull request #69 from almirsarajcic/bug-fixes/email-nil
Browse files Browse the repository at this point in the history
Email without scope
  • Loading branch information
tmilewski authored Feb 12, 2017
2 parents 4ae530b + 04e99c7 commit 1c57c79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/omniauth/strategies/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def authorize_params
info do
{
'nickname' => raw_info['login'],
'email' => primary_email,
'email' => email,
'name' => raw_info['name'],
'image' => raw_info['avatar_url'],
'urls' => {
Expand Down
8 changes: 8 additions & 0 deletions spec/omniauth/strategies/github_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@
end
end

context '#info.email' do
it 'should use any available email' do
allow(subject).to receive(:raw_info).and_return({})
allow(subject).to receive(:email).and_return('[email protected]')
expect(subject.info['email']).to eq('[email protected]')
end
end

context '#info.urls' do
it 'should use html_url from raw_info' do
allow(subject).to receive(:raw_info).and_return({ 'login' => 'me', 'html_url' => 'http://enterprise/me' })
Expand Down

0 comments on commit 1c57c79

Please sign in to comment.