File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
lib/google/api_client/auth/storages
spec/google/api_client/auth/storages Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,9 @@ class RedisStore
24
24
# Initializes the RedisStore object.
25
25
#
26
26
# @params [Object] Redis instance
27
- def initialize ( redis )
27
+ def initialize ( redis , key = nil )
28
28
@redis = redis
29
+ @redis_credentials_key = key
29
30
end
30
31
31
32
##
@@ -36,7 +37,7 @@ def load_credentials
36
37
end
37
38
38
39
def redis_credentials_key
39
- "google_api_credentials"
40
+ @redis_credentials_key || "google_api_credentials"
40
41
end
41
42
42
43
##
Original file line number Diff line number Diff line change 43
43
end
44
44
end
45
45
46
+ describe 'redis_credentials_key' do
47
+ context 'without given key' do
48
+ it 'should return default key' do
49
+ subject . redis_credentials_key . should == "google_api_credentials"
50
+ end
51
+ end
52
+ context 'with given key' do
53
+ let ( :redis_store ) { Google ::APIClient ::RedisStore . new ( 'a redis instance' , 'another_google_api_credentials' ) }
54
+ it 'should use given key' do
55
+ redis_store . redis_credentials_key . should == "another_google_api_credentials"
56
+ end
57
+ end
58
+
59
+ end
60
+
46
61
describe 'write credentials' do
47
62
48
63
it 'should write credentials' do
You can’t perform that action at this time.
0 commit comments