File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def authorize_params
3939 end
4040
4141 extra do
42- { :raw_info => raw_info , :all_emails => emails }
42+ { :raw_info => raw_info , :all_emails => emails , :scope => scope }
4343 end
4444
4545 def raw_info
@@ -51,6 +51,10 @@ def email
5151 ( email_access_allowed? ) ? primary_email : raw_info [ 'email' ]
5252 end
5353
54+ def scope
55+ access_token [ 'scope' ]
56+ end
57+
5458 def primary_email
5559 primary = emails . find { |i | i [ 'primary' ] && i [ 'verified' ] }
5660 primary && primary [ 'email' ] || nil
Original file line number Diff line number Diff line change 11require 'spec_helper'
22
33describe OmniAuth ::Strategies ::GitHub do
4- let ( :access_token ) { instance_double ( 'AccessToken' , :options => { } ) }
4+ let ( :access_token ) { instance_double ( 'AccessToken' , :options => { } , :[] => 'user' ) }
55 let ( :parsed_response ) { instance_double ( 'ParsedResponse' ) }
66 let ( :response ) { instance_double ( 'Response' , :parsed => parsed_response ) }
77
166166 end
167167 end
168168
169+ context '#extra.scope' do
170+ it 'returns the scope on the returned access_token' do
171+ expect ( subject . scope ) . to eq ( 'user' )
172+ end
173+ end
174+
169175 describe '#callback_url' do
170176 it 'is a combination of host, script name, and callback path' do
171177 allow ( subject ) . to receive ( :full_host ) . and_return ( 'https://example.com' )
You can’t perform that action at this time.
0 commit comments