File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def authorize_params
39
39
end
40
40
41
41
extra do
42
- { :raw_info => raw_info , :all_emails => emails }
42
+ { :raw_info => raw_info , :all_emails => emails , :scope => scope }
43
43
end
44
44
45
45
def raw_info
@@ -51,6 +51,10 @@ def email
51
51
( email_access_allowed? ) ? primary_email : raw_info [ 'email' ]
52
52
end
53
53
54
+ def scope
55
+ access_token [ 'scope' ]
56
+ end
57
+
54
58
def primary_email
55
59
primary = emails . find { |i | i [ 'primary' ] && i [ 'verified' ] }
56
60
primary && primary [ 'email' ] || nil
Original file line number Diff line number Diff line change 1
1
require 'spec_helper'
2
2
3
3
describe OmniAuth ::Strategies ::GitHub do
4
- let ( :access_token ) { instance_double ( 'AccessToken' , :options => { } ) }
4
+ let ( :access_token ) { instance_double ( 'AccessToken' , :options => { } , :[] => 'user' ) }
5
5
let ( :parsed_response ) { instance_double ( 'ParsedResponse' ) }
6
6
let ( :response ) { instance_double ( 'Response' , :parsed => parsed_response ) }
7
7
150
150
end
151
151
end
152
152
153
+ context '#extra.scope' do
154
+ it 'returns the scope on the returned access_token' do
155
+ expect ( subject . scope ) . to eq ( 'user' )
156
+ end
157
+ end
158
+
153
159
describe '#callback_url' do
154
160
it 'is a combination of host, script name, and callback path' do
155
161
allow ( subject ) . to receive ( :full_host ) . and_return ( 'https://example.com' )
You can’t perform that action at this time.
0 commit comments