From 60a079a41ea4343b7d2125300cca96e157fba5fd Mon Sep 17 00:00:00 2001 From: Todd Derr Date: Mon, 29 Jun 2015 16:50:55 -0400 Subject: [PATCH 1/2] Fix 'raise_error' WARNINGs. rspec spews a warning when using raise_error without a specific error; add "RuntimeError" to all of these occurrences. --- spec/googleauth/get_application_default_spec.rb | 5 +++-- spec/googleauth/service_account_spec.rb | 4 ++-- spec/googleauth/user_refresh_spec.rb | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spec/googleauth/get_application_default_spec.rb b/spec/googleauth/get_application_default_spec.rb index e143b0b..3e33d3b 100644 --- a/spec/googleauth/get_application_default_spec.rb +++ b/spec/googleauth/get_application_default_spec.rb @@ -58,7 +58,8 @@ describe '#get_application_default' do Dir.mktmpdir do |dir| key_path = File.join(dir, 'does-not-exist') ENV[@var_name] = key_path - expect { Google::Auth.get_application_default(@scope) }.to raise_error + expect { Google::Auth.get_application_default(@scope) }. + to raise_error RuntimeError end end @@ -79,7 +80,7 @@ describe '#get_application_default' do blk = proc do Google::Auth.get_application_default(@scope, connection: c) end - expect(&blk).to raise_error + expect(&blk).to raise_error RuntimeError end stubs.verify_stubbed_calls end diff --git a/spec/googleauth/service_account_spec.rb b/spec/googleauth/service_account_spec.rb index 7c3209f..2f727f5 100644 --- a/spec/googleauth/service_account_spec.rb +++ b/spec/googleauth/service_account_spec.rb @@ -182,7 +182,7 @@ describe Google::Auth::ServiceAccountCredentials do Dir.mktmpdir do |dir| key_path = File.join(dir, 'does-not-exist') ENV[@var_name] = key_path - expect { @clz.from_env(@scope) }.to raise_error + expect { @clz.from_env(@scope) }.to raise_error RuntimeError end end @@ -285,7 +285,7 @@ describe Google::Auth::ServiceAccountJwtHeaderCredentials do Dir.mktmpdir do |dir| key_path = File.join(dir, 'does-not-exist') ENV[@var_name] = key_path - expect { clz.from_env }.to raise_error + expect { clz.from_env }.to raise_error RuntimeError end end diff --git a/spec/googleauth/user_refresh_spec.rb b/spec/googleauth/user_refresh_spec.rb index 64047ec..6bc7ad1 100644 --- a/spec/googleauth/user_refresh_spec.rb +++ b/spec/googleauth/user_refresh_spec.rb @@ -108,7 +108,7 @@ describe Google::Auth::UserRefreshCredentials do Dir.mktmpdir do |dir| key_path = File.join(dir, 'does-not-exist') ENV[@var_name] = key_path - expect { @clz.from_env(@scope) }.to raise_error + expect { @clz.from_env(@scope) }.to raise_error RuntimeError end end @@ -120,7 +120,7 @@ describe Google::Auth::UserRefreshCredentials do FileUtils.mkdir_p(File.dirname(key_path)) File.write(key_path, cred_json_text(missing)) ENV[@var_name] = key_path - expect { @clz.from_env(@scope) }.to raise_error + expect { @clz.from_env(@scope) }.to raise_error RuntimeError end end end @@ -170,7 +170,8 @@ describe Google::Auth::UserRefreshCredentials do FileUtils.mkdir_p(File.dirname(key_path)) File.write(key_path, cred_json_text(missing)) ENV['HOME'] = dir - expect { @clz.from_well_known_path(@scope) }.to raise_error + expect { @clz.from_well_known_path(@scope) }. + to raise_error RuntimeError end end end From b31df0caaa2bcbead4b5bcc39cb76a1a8a982c29 Mon Sep 17 00:00:00 2001 From: Todd Derr Date: Tue, 30 Jun 2015 17:47:16 -0400 Subject: [PATCH 2/2] Fix rubocop errors (long line wrapping). --- spec/googleauth/get_application_default_spec.rb | 4 ++-- spec/googleauth/user_refresh_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/googleauth/get_application_default_spec.rb b/spec/googleauth/get_application_default_spec.rb index 3e33d3b..a8411a8 100644 --- a/spec/googleauth/get_application_default_spec.rb +++ b/spec/googleauth/get_application_default_spec.rb @@ -58,8 +58,8 @@ describe '#get_application_default' do Dir.mktmpdir do |dir| key_path = File.join(dir, 'does-not-exist') ENV[@var_name] = key_path - expect { Google::Auth.get_application_default(@scope) }. - to raise_error RuntimeError + expect { Google::Auth.get_application_default(@scope) } + .to raise_error RuntimeError end end diff --git a/spec/googleauth/user_refresh_spec.rb b/spec/googleauth/user_refresh_spec.rb index 6bc7ad1..fd12edd 100644 --- a/spec/googleauth/user_refresh_spec.rb +++ b/spec/googleauth/user_refresh_spec.rb @@ -170,8 +170,8 @@ describe Google::Auth::UserRefreshCredentials do FileUtils.mkdir_p(File.dirname(key_path)) File.write(key_path, cred_json_text(missing)) ENV['HOME'] = dir - expect { @clz.from_well_known_path(@scope) }. - to raise_error RuntimeError + expect { @clz.from_well_known_path(@scope) } + .to raise_error RuntimeError end end end