change default for authorization to nil
This commit is contained in:
parent
18c4bab286
commit
b1f8ac3c0d
|
@ -57,7 +57,7 @@ module Google
|
|||
# Loads credentials and authorizes an client.
|
||||
# @return [Object] Signet::OAuth2::Client or NIL
|
||||
def authorize
|
||||
@authorization = false
|
||||
@authorization = nil
|
||||
cached_credentials = load_credentials
|
||||
if cached_credentials && cached_credentials.size > 0
|
||||
@authorization = Signet::OAuth2::Client.new(cached_credentials)
|
||||
|
|
|
@ -38,15 +38,19 @@ describe Google::APIClient::Storage do
|
|||
client_stub.stub(:expired?).and_return(true)
|
||||
Signet::OAuth2::Client.should_receive(:new).and_return(client_stub)
|
||||
subject.should_receive(:refresh_authorization)
|
||||
subject.authorize
|
||||
auth = subject.authorize
|
||||
auth.should == subject.authorization
|
||||
auth.should_not be_nil
|
||||
end
|
||||
end
|
||||
|
||||
describe 'without credentials' do
|
||||
|
||||
it 'should return false' do
|
||||
it 'should return nil' do
|
||||
subject.authorization.should be_nil
|
||||
subject.should_receive(:load_credentials).and_return({})
|
||||
subject.authorize.should be_false
|
||||
subject.authorize.should be_nil
|
||||
subject.authorization.should be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue