-
-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure
info[:email]
is always verified, and include `unverified_ema…
…il` (#363) This is a 'safe by default' replacement for efe0e90 Add changelog and bump version Keep email_verified boolean available for 0.6.1 users
- Loading branch information
1 parent
2f6c464
commit 8b4d6da
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module OmniAuth | ||
module GoogleOauth2 | ||
VERSION = '0.6.1' | ||
VERSION = '0.7.0' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,6 +300,41 @@ | |
end | ||
end | ||
|
||
describe '#info' do | ||
let(:client) do | ||
OAuth2::Client.new('abc', 'def') do |builder| | ||
builder.request :url_encoded | ||
builder.adapter :test do |stub| | ||
stub.get('/oauth2/v3/userinfo') { [200, { 'content-type' => 'application/json' }, response_hash.to_json] } | ||
end | ||
end | ||
end | ||
let(:access_token) { OAuth2::AccessToken.from_hash(client, {}) } | ||
before { allow(subject).to receive(:access_token).and_return(access_token) } | ||
|
||
context 'with verified email' do | ||
let(:response_hash) do | ||
{ email: '[email protected]', email_verified: true } | ||
end | ||
|
||
it 'should return equal email and unverified_email' do | ||
expect(subject.info[:email]).to eq('[email protected]') | ||
expect(subject.info[:unverified_email]).to eq('[email protected]') | ||
end | ||
end | ||
|
||
context 'with unverified email' do | ||
let(:response_hash) do | ||
{ email: '[email protected]', email_verified: false } | ||
end | ||
|
||
it 'should return nil email, and correct unverified email' do | ||
expect(subject.info[:email]).to eq(nil) | ||
expect(subject.info[:unverified_email]).to eq('[email protected]') | ||
end | ||
end | ||
end | ||
|
||
describe '#extra' do | ||
let(:client) do | ||
OAuth2::Client.new('abc', 'def') do |builder| | ||
|