googleauth 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.kokoro/build.sh +2 -34
  3. data/.kokoro/continuous/common.cfg +5 -0
  4. data/.kokoro/continuous/linux.cfg +1 -1
  5. data/.kokoro/osx.sh +2 -33
  6. data/.kokoro/presubmit/common.cfg +5 -0
  7. data/.kokoro/presubmit/linux.cfg +1 -1
  8. data/.kokoro/release.cfg +53 -0
  9. data/.kokoro/trampoline.sh +3 -23
  10. data/.kokoro/windows.sh +2 -30
  11. data/.rubocop.yml +7 -24
  12. data/CHANGELOG.md +24 -39
  13. data/Gemfile +14 -14
  14. data/README.md +21 -1
  15. data/Rakefile +84 -10
  16. data/googleauth.gemspec +23 -23
  17. data/lib/googleauth.rb +6 -6
  18. data/lib/googleauth/application_default.rb +11 -11
  19. data/lib/googleauth/client_id.rb +16 -16
  20. data/lib/googleauth/compute_engine.rb +27 -27
  21. data/lib/googleauth/credentials.rb +35 -37
  22. data/lib/googleauth/credentials_loader.rb +64 -67
  23. data/lib/googleauth/default_credentials.rb +18 -18
  24. data/lib/googleauth/iam.rb +9 -9
  25. data/lib/googleauth/json_key_reader.rb +6 -6
  26. data/lib/googleauth/scope_util.rb +11 -11
  27. data/lib/googleauth/service_account.rb +42 -42
  28. data/lib/googleauth/signet.rb +15 -17
  29. data/lib/googleauth/stores/file_token_store.rb +8 -8
  30. data/lib/googleauth/stores/redis_token_store.rb +17 -17
  31. data/lib/googleauth/token_store.rb +6 -6
  32. data/lib/googleauth/user_authorizer.rb +55 -59
  33. data/lib/googleauth/user_refresh.rb +27 -27
  34. data/lib/googleauth/version.rb +1 -1
  35. data/lib/googleauth/web_user_authorizer.rb +55 -56
  36. data/spec/googleauth/apply_auth_examples.rb +46 -46
  37. data/spec/googleauth/client_id_spec.rb +54 -54
  38. data/spec/googleauth/compute_engine_spec.rb +41 -41
  39. data/spec/googleauth/credentials_spec.rb +97 -97
  40. data/spec/googleauth/get_application_default_spec.rb +114 -114
  41. data/spec/googleauth/iam_spec.rb +25 -25
  42. data/spec/googleauth/scope_util_spec.rb +24 -24
  43. data/spec/googleauth/service_account_spec.rb +204 -194
  44. data/spec/googleauth/signet_spec.rb +37 -38
  45. data/spec/googleauth/stores/file_token_store_spec.rb +12 -12
  46. data/spec/googleauth/stores/redis_token_store_spec.rb +11 -11
  47. data/spec/googleauth/stores/store_examples.rb +16 -16
  48. data/spec/googleauth/user_authorizer_spec.rb +120 -121
  49. data/spec/googleauth/user_refresh_spec.rb +151 -146
  50. data/spec/googleauth/web_user_authorizer_spec.rb +66 -66
  51. data/spec/spec_helper.rb +19 -19
  52. metadata +4 -6
  53. data/.kokoro/common.cfg +0 -22
  54. data/.travis.yml +0 -40
@@ -27,64 +27,64 @@
27
27
  # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
28
  # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 
30
- spec_dir = File.expand_path(File.join(File.dirname(__FILE__)))
31
- $LOAD_PATH.unshift(spec_dir)
30
+ spec_dir = File.expand_path File.join(File.dirname(__FILE__))
31
+ $LOAD_PATH.unshift spec_dir
32
32
  $LOAD_PATH.uniq!
33
33
 
34
- require 'apply_auth_examples'
35
- require 'fakefs/safe'
36
- require 'fileutils'
37
- require 'googleauth/user_refresh'
38
- require 'jwt'
39
- require 'multi_json'
40
- require 'openssl'
41
- require 'spec_helper'
42
- require 'tmpdir'
43
- require 'os'
34
+ require "apply_auth_examples"
35
+ require "fakefs/safe"
36
+ require "fileutils"
37
+ require "googleauth/user_refresh"
38
+ require "jwt"
39
+ require "multi_json"
40
+ require "openssl"
41
+ require "spec_helper"
42
+ require "tmpdir"
43
+ require "os"
44
44
 
45
45
  include Google::Auth::CredentialsLoader
46
46
 
47
47
  describe Google::Auth::UserRefreshCredentials do
48
48
  UserRefreshCredentials = Google::Auth::UserRefreshCredentials
49
49
 
50
- let(:cred_json) do
50
+ let :cred_json do
51
51
  {
52
- client_secret: 'privatekey',
53
- client_id: 'client123',
54
- refresh_token: 'refreshtoken',
55
- type: 'authorized_user'
52
+ client_secret: "privatekey",
53
+ client_id: "client123",
54
+ refresh_token: "refreshtoken",
55
+ type: "authorized_user"
56
56
  }
57
57
  end
58
58
 
59
- before(:example) do
60
- @key = OpenSSL::PKey::RSA.new(2048)
59
+ before :example do
60
+ @key = OpenSSL::PKey::RSA.new 2048
61
61
  @client = UserRefreshCredentials.make_creds(
62
62
  json_key_io: StringIO.new(cred_json_text),
63
- scope: 'https://www.googleapis.com/auth/userinfo.profile'
63
+ scope: "https://www.googleapis.com/auth/userinfo.profile"
64
64
  )
65
65
  end
66
66
 
67
- def make_auth_stubs(opts = {})
68
- access_token = opts[:access_token] || ''
69
- body = MultiJson.dump('access_token' => access_token,
70
- 'token_type' => 'Bearer',
71
- 'expires_in' => 3600)
72
- stub_request(:post, 'https://oauth2.googleapis.com/token')
73
- .with(body: hash_including('grant_type' => 'refresh_token'))
74
- .to_return(body: body,
75
- status: 200,
76
- headers: { 'Content-Type' => 'application/json' })
67
+ def make_auth_stubs opts = {}
68
+ access_token = opts[:access_token] || ""
69
+ body = MultiJson.dump("access_token" => access_token,
70
+ "token_type" => "Bearer",
71
+ "expires_in" => 3600)
72
+ stub_request(:post, "https://oauth2.googleapis.com/token")
73
+ .with(body: hash_including("grant_type" => "refresh_token"))
74
+ .to_return(body: body,
75
+ status: 200,
76
+ headers: { "Content-Type" => "application/json" })
77
77
  end
78
78
 
79
- def cred_json_text(missing = nil)
80
- cred_json.delete(missing.to_sym) unless missing.nil?
81
- MultiJson.dump(cred_json)
79
+ def cred_json_text missing = nil
80
+ cred_json.delete missing.to_sym unless missing.nil?
81
+ MultiJson.dump cred_json
82
82
  end
83
83
 
84
- it_behaves_like 'apply/apply! are OK'
84
+ it_behaves_like "apply/apply! are OK"
85
85
 
86
- describe '#from_env' do
87
- before(:example) do
86
+ describe "#from_env" do
87
+ before :example do
88
88
  @var_name = ENV_VAR
89
89
  @credential_vars = [
90
90
  ENV_VAR, CLIENT_ID_VAR, CLIENT_SECRET_VAR, REFRESH_TOKEN_VAR,
@@ -92,243 +92,248 @@ describe Google::Auth::UserRefreshCredentials do
92
92
  ]
93
93
  @original_env_vals = {}
94
94
  @credential_vars.each { |var| @original_env_vals[var] = ENV[var] }
95
- @scope = 'https://www.googleapis.com/auth/userinfo.profile'
95
+ @scope = "https://www.googleapis.com/auth/userinfo.profile"
96
96
  @clz = UserRefreshCredentials
97
- @project_id = 'a_project_id'
97
+ @project_id = "a_project_id"
98
98
  end
99
99
 
100
- after(:example) do
100
+ after :example do
101
101
  @credential_vars.each { |var| ENV[var] = @original_env_vals[var] }
102
102
  end
103
103
 
104
- it 'returns nil if the GOOGLE_APPLICATION_CREDENTIALS is unset' do
105
- ENV.delete(@var_name) unless ENV[@var_name].nil?
104
+ it "returns nil if the GOOGLE_APPLICATION_CREDENTIALS is unset" do
105
+ ENV.delete @var_name unless ENV[@var_name].nil?
106
106
  expect(UserRefreshCredentials.from_env(@scope)).to be_nil
107
107
  end
108
108
 
109
- it 'fails if the GOOGLE_APPLICATION_CREDENTIALS path does not exist' do
110
- ENV.delete(@var_name) unless ENV[@var_name].nil?
109
+ it "returns nil if the GOOGLE_APPLICATION_CREDENTIALS is empty" do
110
+ ENV[@var_name] = ""
111
+ expect(UserRefreshCredentials.from_env(@scope)).to be_nil
112
+ end
113
+
114
+ it "fails if the GOOGLE_APPLICATION_CREDENTIALS path does not exist" do
115
+ ENV.delete @var_name unless ENV[@var_name].nil?
111
116
  expect(UserRefreshCredentials.from_env(@scope)).to be_nil
112
117
  Dir.mktmpdir do |dir|
113
- key_path = File.join(dir, 'does-not-exist')
118
+ key_path = File.join dir, "does-not-exist"
114
119
  ENV[@var_name] = key_path
115
- expect { @clz.from_env(@scope) }.to raise_error RuntimeError
120
+ expect { @clz.from_env @scope }.to raise_error RuntimeError
116
121
  end
117
122
  end
118
123
 
119
- it 'fails if the GOOGLE_APPLICATION_CREDENTIALS path file is invalid' do
120
- needed = %w(client_id client_secret refresh_token)
124
+ it "fails if the GOOGLE_APPLICATION_CREDENTIALS path file is invalid" do
125
+ needed = %w[client_id client_secret refresh_token]
121
126
  needed.each do |missing|
122
127
  Dir.mktmpdir do |dir|
123
- key_path = File.join(dir, 'my_cert_file')
124
- FileUtils.mkdir_p(File.dirname(key_path))
125
- File.write(key_path, cred_json_text(missing))
128
+ key_path = File.join dir, "my_cert_file"
129
+ FileUtils.mkdir_p File.dirname(key_path)
130
+ File.write key_path, cred_json_text(missing)
126
131
  ENV[@var_name] = key_path
127
- expect { @clz.from_env(@scope) }.to raise_error RuntimeError
132
+ expect { @clz.from_env @scope }.to raise_error RuntimeError
128
133
  end
129
134
  end
130
135
  end
131
136
 
132
- it 'succeeds when the GOOGLE_APPLICATION_CREDENTIALS file is valid' do
137
+ it "succeeds when the GOOGLE_APPLICATION_CREDENTIALS file is valid" do
133
138
  Dir.mktmpdir do |dir|
134
- key_path = File.join(dir, 'my_cert_file')
135
- FileUtils.mkdir_p(File.dirname(key_path))
136
- File.write(key_path, cred_json_text)
139
+ key_path = File.join dir, "my_cert_file"
140
+ FileUtils.mkdir_p File.dirname(key_path)
141
+ File.write key_path, cred_json_text
137
142
  ENV[@var_name] = key_path
138
143
  expect(@clz.from_env(@scope)).to_not be_nil
139
144
  end
140
145
  end
141
146
 
142
- it 'succeeds when GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and '\
143
- 'GOOGLE_REFRESH_TOKEN env vars are valid' do
147
+ it "succeeds when GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and "\
148
+ "GOOGLE_REFRESH_TOKEN env vars are valid" do
144
149
  ENV[ENV_VAR] = nil
145
150
  ENV[CLIENT_ID_VAR] = cred_json[:client_id]
146
151
  ENV[CLIENT_SECRET_VAR] = cred_json[:client_secret]
147
152
  ENV[REFRESH_TOKEN_VAR] = cred_json[:refresh_token]
148
153
  ENV[ACCOUNT_TYPE_VAR] = cred_json[:type]
149
- creds = @clz.from_env(@scope)
154
+ creds = @clz.from_env @scope
150
155
  expect(creds).to_not be_nil
151
156
  expect(creds.client_id).to eq(cred_json[:client_id])
152
157
  expect(creds.client_secret).to eq(cred_json[:client_secret])
153
158
  expect(creds.refresh_token).to eq(cred_json[:refresh_token])
154
159
  end
155
160
 
156
- it 'sets project_id when the PROJECT_ID_VAR env var is set' do
161
+ it "sets project_id when the PROJECT_ID_VAR env var is set" do
157
162
  ENV[ENV_VAR] = nil
158
163
  ENV[CLIENT_ID_VAR] = cred_json[:client_id]
159
164
  ENV[CLIENT_SECRET_VAR] = cred_json[:client_secret]
160
165
  ENV[REFRESH_TOKEN_VAR] = cred_json[:refresh_token]
161
166
  ENV[ACCOUNT_TYPE_VAR] = cred_json[:type]
162
167
  ENV[PROJECT_ID_VAR] = @project_id
163
- creds = @clz.from_env(@scope)
168
+ creds = @clz.from_env @scope
164
169
  expect(creds.project_id).to eq(@project_id)
165
170
  end
166
171
  end
167
172
 
168
- describe '#from_well_known_path' do
169
- before(:example) do
170
- @home = ENV['HOME']
171
- @app_data = ENV['APPDATA']
172
- @scope = 'https://www.googleapis.com/auth/userinfo.profile'
173
+ describe "#from_well_known_path" do
174
+ before :example do
175
+ @home = ENV["HOME"]
176
+ @app_data = ENV["APPDATA"]
177
+ @scope = "https://www.googleapis.com/auth/userinfo.profile"
173
178
  @known_path = WELL_KNOWN_PATH
174
179
  @clz = UserRefreshCredentials
175
180
  end
176
181
 
177
- after(:example) do
178
- ENV['HOME'] = @home unless @home == ENV['HOME']
179
- ENV['APPDATA'] = @app_data unless @app_data == ENV['APPDATA']
182
+ after :example do
183
+ ENV["HOME"] = @home unless @home == ENV["HOME"]
184
+ ENV["APPDATA"] = @app_data unless @app_data == ENV["APPDATA"]
180
185
  end
181
186
 
182
- it 'is nil if no file exists' do
183
- ENV['HOME'] = File.dirname(__FILE__)
187
+ it "is nil if no file exists" do
188
+ ENV["HOME"] = File.dirname __FILE__
184
189
  expect(UserRefreshCredentials.from_well_known_path(@scope)).to be_nil
185
190
  end
186
191
 
187
- it 'fails if the file is invalid' do
188
- needed = %w(client_id client_secret refresh_token)
192
+ it "fails if the file is invalid" do
193
+ needed = %w[client_id client_secret refresh_token]
189
194
  needed.each do |missing|
190
195
  Dir.mktmpdir do |dir|
191
- key_path = File.join(dir, '.config', @known_path)
192
- key_path = File.join(dir, @known_path) if OS.windows?
193
- FileUtils.mkdir_p(File.dirname(key_path))
194
- File.write(key_path, cred_json_text(missing))
195
- ENV['HOME'] = dir
196
- ENV['APPDATA'] = dir
197
- expect { @clz.from_well_known_path(@scope) }
196
+ key_path = File.join dir, ".config", @known_path
197
+ key_path = File.join dir, @known_path if OS.windows?
198
+ FileUtils.mkdir_p File.dirname(key_path)
199
+ File.write key_path, cred_json_text(missing)
200
+ ENV["HOME"] = dir
201
+ ENV["APPDATA"] = dir
202
+ expect { @clz.from_well_known_path @scope }
198
203
  .to raise_error RuntimeError
199
204
  end
200
205
  end
201
206
  end
202
207
 
203
- it 'successfully loads the file when it is present' do
208
+ it "successfully loads the file when it is present" do
204
209
  Dir.mktmpdir do |dir|
205
- key_path = File.join(dir, '.config', @known_path)
206
- key_path = File.join(dir, @known_path) if OS.windows?
207
- FileUtils.mkdir_p(File.dirname(key_path))
208
- File.write(key_path, cred_json_text)
209
- ENV['HOME'] = dir
210
- ENV['APPDATA'] = dir
210
+ key_path = File.join dir, ".config", @known_path
211
+ key_path = File.join dir, @known_path if OS.windows?
212
+ FileUtils.mkdir_p File.dirname(key_path)
213
+ File.write key_path, cred_json_text
214
+ ENV["HOME"] = dir
215
+ ENV["APPDATA"] = dir
211
216
  expect(@clz.from_well_known_path(@scope)).to_not be_nil
212
217
  end
213
218
  end
214
219
 
215
- it 'checks gcloud config for project_id if none was provided' do
220
+ it "checks gcloud config for project_id if none was provided" do
216
221
  Dir.mktmpdir do |dir|
217
- key_path = File.join(dir, '.config', @known_path)
218
- key_path = File.join(dir, @known_path) if OS.windows?
219
- FileUtils.mkdir_p(File.dirname(key_path))
220
- File.write(key_path, cred_json_text)
221
- ENV['HOME'] = dir
222
- ENV['APPDATA'] = dir
222
+ key_path = File.join dir, ".config", @known_path
223
+ key_path = File.join dir, @known_path if OS.windows?
224
+ FileUtils.mkdir_p File.dirname(key_path)
225
+ File.write key_path, cred_json_text
226
+ ENV["HOME"] = dir
227
+ ENV["APPDATA"] = dir
223
228
  ENV[PROJECT_ID_VAR] = nil
224
229
  expect(Google::Auth::CredentialsLoader).to receive(:load_gcloud_project_id).with(no_args)
225
- @clz.from_well_known_path(@scope)
230
+ @clz.from_well_known_path @scope
226
231
  end
227
232
  end
228
233
  end
229
234
 
230
- describe '#from_system_default_path' do
231
- before(:example) do
232
- @scope = 'https://www.googleapis.com/auth/userinfo.profile'
233
- @prefix = OS.windows? ? '/etc/Google/Auth/' : '/etc/google/auth/'
234
- @path = File.join(@prefix, CREDENTIALS_FILE_NAME)
235
- @program_data = ENV['ProgramData']
235
+ describe "#from_system_default_path" do
236
+ before :example do
237
+ @scope = "https://www.googleapis.com/auth/userinfo.profile"
238
+ @prefix = OS.windows? ? "/etc/Google/Auth/" : "/etc/google/auth/"
239
+ @path = File.join @prefix, CREDENTIALS_FILE_NAME
240
+ @program_data = ENV["ProgramData"]
236
241
  @clz = UserRefreshCredentials
237
242
  end
238
243
 
239
- after(:example) do
240
- ENV['ProgramData'] = @program_data
244
+ after :example do
245
+ ENV["ProgramData"] = @program_data
241
246
  end
242
247
 
243
- it 'is nil if no file exists' do
248
+ it "is nil if no file exists" do
244
249
  FakeFS do
245
250
  expect(UserRefreshCredentials.from_system_default_path(@scope))
246
251
  .to be_nil
247
252
  end
248
253
  end
249
254
 
250
- it 'fails if the file is invalid' do
251
- needed = %w(client_id client_secret refresh_token)
255
+ it "fails if the file is invalid" do
256
+ needed = %w[client_id client_secret refresh_token]
252
257
  needed.each do |missing|
253
258
  FakeFS do
254
- ENV['ProgramData'] = '/etc'
255
- FileUtils.mkdir_p(File.dirname(@path))
256
- File.write(@path, cred_json_text(missing))
257
- expect { @clz.from_system_default_path(@scope) }
259
+ ENV["ProgramData"] = "/etc"
260
+ FileUtils.mkdir_p File.dirname(@path)
261
+ File.write @path, cred_json_text(missing)
262
+ expect { @clz.from_system_default_path @scope }
258
263
  .to raise_error RuntimeError
259
- File.delete(@path)
264
+ File.delete @path
260
265
  end
261
266
  end
262
267
  end
263
268
 
264
- it 'successfully loads the file when it is present' do
269
+ it "successfully loads the file when it is present" do
265
270
  FakeFS do
266
- ENV['ProgramData'] = '/etc'
267
- FileUtils.mkdir_p(File.dirname(@path))
268
- File.write(@path, cred_json_text)
271
+ ENV["ProgramData"] = "/etc"
272
+ FileUtils.mkdir_p File.dirname(@path)
273
+ File.write @path, cred_json_text
269
274
  expect(@clz.from_system_default_path(@scope)).to_not be_nil
270
- File.delete(@path)
275
+ File.delete @path
271
276
  end
272
277
  end
273
278
  end
274
279
 
275
- shared_examples 'revoked token' do
276
- it 'should nil the refresh token' do
280
+ shared_examples "revoked token" do
281
+ it "should nil the refresh token" do
277
282
  expect(@client.refresh_token).to be_nil
278
283
  end
279
284
 
280
- it 'should nil the access token' do
285
+ it "should nil the access token" do
281
286
  expect(@client.access_token).to be_nil
282
287
  end
283
288
 
284
- it 'should mark the token as expired' do
289
+ it "should mark the token as expired" do
285
290
  expect(@client.expired?).to be_truthy
286
291
  end
287
292
  end
288
293
 
289
- describe 'when revoking a refresh token' do
290
- let(:stub) do
291
- stub_request(:post, 'https://oauth2.googleapis.com/revoke')
292
- .with(body: hash_including('token' => 'refreshtoken'))
293
- .to_return(status: 200,
294
- headers: { 'Content-Type' => 'application/json' })
294
+ describe "when revoking a refresh token" do
295
+ let :stub do
296
+ stub_request(:post, "https://oauth2.googleapis.com/revoke")
297
+ .with(body: hash_including("token" => "refreshtoken"))
298
+ .to_return(status: 200,
299
+ headers: { "Content-Type" => "application/json" })
295
300
  end
296
301
 
297
- before(:example) do
302
+ before :example do
298
303
  stub
299
304
  @client.revoke!
300
305
  end
301
306
 
302
- it_behaves_like 'revoked token'
307
+ it_behaves_like "revoked token"
303
308
  end
304
309
 
305
- describe 'when revoking an access token' do
306
- let(:stub) do
307
- stub_request(:post, 'https://oauth2.googleapis.com/revoke')
308
- .with(body: hash_including('token' => 'accesstoken'))
309
- .to_return(status: 200,
310
- headers: { 'Content-Type' => 'application/json' })
310
+ describe "when revoking an access token" do
311
+ let :stub do
312
+ stub_request(:post, "https://oauth2.googleapis.com/revoke")
313
+ .with(body: hash_including("token" => "accesstoken"))
314
+ .to_return(status: 200,
315
+ headers: { "Content-Type" => "application/json" })
311
316
  end
312
317
 
313
- before(:example) do
318
+ before :example do
314
319
  stub
315
320
  @client.refresh_token = nil
316
- @client.access_token = 'accesstoken'
321
+ @client.access_token = "accesstoken"
317
322
  @client.revoke!
318
323
  end
319
324
 
320
- it_behaves_like 'revoked token'
325
+ it_behaves_like "revoked token"
321
326
  end
322
327
 
323
- describe 'when revoking an invalid token' do
324
- let(:stub) do
325
- stub_request(:post, 'https://oauth2.googleapis.com/revoke')
326
- .with(body: hash_including('token' => 'refreshtoken'))
327
- .to_return(status: 400,
328
- headers: { 'Content-Type' => 'application/json' })
328
+ describe "when revoking an invalid token" do
329
+ let :stub do
330
+ stub_request(:post, "https://oauth2.googleapis.com/revoke")
331
+ .with(body: hash_including("token" => "refreshtoken"))
332
+ .to_return(status: 400,
333
+ headers: { "Content-Type" => "application/json" })
329
334
  end
330
335
 
331
- it 'raises an authorization error' do
336
+ it "raises an authorization error" do
332
337
  stub
333
338
  expect { @client.revoke! }.to raise_error(
334
339
  Signet::AuthorizationError
@@ -336,15 +341,15 @@ describe Google::Auth::UserRefreshCredentials do
336
341
  end
337
342
  end
338
343
 
339
- describe 'when errors occurred with request' do
340
- it 'should fail with Signet::AuthorizationError if request times out' do
344
+ describe "when errors occurred with request" do
345
+ it "should fail with Signet::AuthorizationError if request times out" do
341
346
  allow_any_instance_of(Faraday::Connection).to receive(:post)
342
347
  .and_raise(Faraday::TimeoutError)
343
348
  expect { @client.revoke! }
344
349
  .to raise_error Signet::AuthorizationError
345
350
  end
346
351
 
347
- it 'should fail with Signet::AuthorizationError if request fails' do
352
+ it "should fail with Signet::AuthorizationError if request fails" do
348
353
  allow_any_instance_of(Faraday::Connection).to receive(:post)
349
354
  .and_raise(Faraday::ConnectionFailed, nil)
350
355
  expect { @client.revoke! }