mirror of
https://github.com/simi/omniauth-facebook.git
synced 2022-11-09 12:32:45 -05:00
obey skip_info? config
This commit is contained in:
parent
8bb4e86ec9
commit
88f47364f1
2 changed files with 12 additions and 4 deletions
|
@ -47,9 +47,9 @@ module OmniAuth
|
||||||
end
|
end
|
||||||
|
|
||||||
extra do
|
extra do
|
||||||
prune!({
|
hash = {}
|
||||||
'raw_info' => raw_info
|
hash['raw_info'] = raw_info unless skip_info?
|
||||||
})
|
prune! hash
|
||||||
end
|
end
|
||||||
|
|
||||||
def raw_info
|
def raw_info
|
||||||
|
|
|
@ -245,16 +245,17 @@ describe OmniAuth::Strategies::Facebook do
|
||||||
describe '#raw_info' do
|
describe '#raw_info' do
|
||||||
before :each do
|
before :each do
|
||||||
@access_token = double('OAuth2::AccessToken')
|
@access_token = double('OAuth2::AccessToken')
|
||||||
subject.stub(:access_token) { @access_token }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'performs a GET to https://graph.facebook.com/me' do
|
it 'performs a GET to https://graph.facebook.com/me' do
|
||||||
|
subject.stub(:access_token) { @access_token }
|
||||||
@access_token.stub(:get) { double('OAuth2::Response').as_null_object }
|
@access_token.stub(:get) { double('OAuth2::Response').as_null_object }
|
||||||
@access_token.should_receive(:get).with('/me')
|
@access_token.should_receive(:get).with('/me')
|
||||||
subject.raw_info
|
subject.raw_info
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a Hash' do
|
it 'returns a Hash' do
|
||||||
|
subject.stub(:access_token) { @access_token }
|
||||||
@access_token.stub(:get).with('/me') do
|
@access_token.stub(:get).with('/me') do
|
||||||
raw_response = double('Faraday::Response')
|
raw_response = double('Faraday::Response')
|
||||||
raw_response.stub(:body) { '{ "ohai": "thar" }' }
|
raw_response.stub(:body) { '{ "ohai": "thar" }' }
|
||||||
|
@ -267,6 +268,7 @@ describe OmniAuth::Strategies::Facebook do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns an empty hash when the response is false' do
|
it 'returns an empty hash when the response is false' do
|
||||||
|
subject.stub(:access_token) { @access_token }
|
||||||
@access_token.stub(:get).with('/me') do
|
@access_token.stub(:get).with('/me') do
|
||||||
response = double('OAuth2::Response')
|
response = double('OAuth2::Response')
|
||||||
response.stub(:parsed => false)
|
response.stub(:parsed => false)
|
||||||
|
@ -274,6 +276,12 @@ describe OmniAuth::Strategies::Facebook do
|
||||||
end
|
end
|
||||||
subject.raw_info.should be_a(Hash)
|
subject.raw_info.should be_a(Hash)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should not include raw_info in extras hash when skip_info is specified' do
|
||||||
|
@options = { :skip_info => true }
|
||||||
|
subject.stub(:raw_info) { { :foo => 'bar' } }
|
||||||
|
subject.extra.should_not have_key('raw_info')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#credentials' do
|
describe '#credentials' do
|
||||||
|
|
Loading…
Reference in a new issue