Skip to content

Commit b1f8ac3

Browse files
committed
change default for authorization to nil
1 parent 18c4bab commit b1f8ac3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/google/api_client/auth/storage.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def write_credentials(authorization=nil)
5757
# Loads credentials and authorizes an client.
5858
# @return [Object] Signet::OAuth2::Client or NIL
5959
def authorize
60-
@authorization = false
60+
@authorization = nil
6161
cached_credentials = load_credentials
6262
if cached_credentials && cached_credentials.size > 0
6363
@authorization = Signet::OAuth2::Client.new(cached_credentials)

spec/google/api_client/auth/storage_spec.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,19 @@
3838
client_stub.stub(:expired?).and_return(true)
3939
Signet::OAuth2::Client.should_receive(:new).and_return(client_stub)
4040
subject.should_receive(:refresh_authorization)
41-
subject.authorize
41+
auth = subject.authorize
42+
auth.should == subject.authorization
43+
auth.should_not be_nil
4244
end
4345
end
4446

4547
describe 'without credentials' do
4648

47-
it 'should return false' do
49+
it 'should return nil' do
50+
subject.authorization.should be_nil
4851
subject.should_receive(:load_credentials).and_return({})
49-
subject.authorize.should be_false
52+
subject.authorize.should be_nil
53+
subject.authorization.should be_nil
5054
end
5155
end
5256
end

0 commit comments

Comments
 (0)