Fix some issues discovered by rubocop.

fix failures due to:
- misformatting of wrapped lines
- a superflous block (and temp dir creation) due to overzealous cut & paste.
This commit is contained in:
Todd Derr 2015-06-30 17:42:30 -04:00
parent c04e91569d
commit f0de3295fc
3 changed files with 22 additions and 30 deletions

View File

@ -144,7 +144,6 @@ describe '#get_application_default' do
it 'succeeds with system default file' do it 'succeeds with system default file' do
ENV.delete(@var_name) unless ENV[@var_name].nil? ENV.delete(@var_name) unless ENV[@var_name].nil?
FakeFS do FakeFS do
Dir.mktmpdir do |dir|
key_path = File.join('/etc/google/auth/', CREDENTIALS_FILE_NAME) key_path = File.join('/etc/google/auth/', CREDENTIALS_FILE_NAME)
FileUtils.mkdir_p(File.dirname(key_path)) FileUtils.mkdir_p(File.dirname(key_path))
File.write(key_path, cred_json_text) File.write(key_path, cred_json_text)
@ -152,7 +151,6 @@ describe '#get_application_default' do
File.delete(key_path) File.delete(key_path)
end end
end end
end
it 'succeeds if environment vars are valid' do it 'succeeds if environment vars are valid' do
ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var ENV.delete(@var_name) unless ENV[@var_name].nil? # no env var

View File

@ -242,14 +242,13 @@ describe Google::Auth::ServiceAccountCredentials do
it 'is nil if no file exists' do it 'is nil if no file exists' do
FakeFS do FakeFS do
expect(ServiceAccountCredentials.from_system_default_path(@scope)). expect(ServiceAccountCredentials.from_system_default_path(@scope))
to be_nil .to be_nil
end end
end end
it 'successfully loads the file when it is present' do it 'successfully loads the file when it is present' do
FakeFS do FakeFS do
Dir.mktmpdir do |dir|
FileUtils.mkdir_p(File.dirname(@path)) FileUtils.mkdir_p(File.dirname(@path))
File.write(@path, cred_json_text) File.write(@path, cred_json_text)
expect(@clz.from_system_default_path(@scope)).to_not be_nil expect(@clz.from_system_default_path(@scope)).to_not be_nil
@ -258,7 +257,6 @@ describe Google::Auth::ServiceAccountCredentials do
end end
end end
end end
end
describe Google::Auth::ServiceAccountJwtHeaderCredentials do describe Google::Auth::ServiceAccountJwtHeaderCredentials do
ServiceAccountJwtHeaderCredentials = ServiceAccountJwtHeaderCredentials =

View File

@ -196,8 +196,8 @@ describe Google::Auth::UserRefreshCredentials do
it 'is nil if no file exists' do it 'is nil if no file exists' do
FakeFS do FakeFS do
expect(UserRefreshCredentials.from_system_default_path(@scope)). expect(UserRefreshCredentials.from_system_default_path(@scope))
to be_nil .to be_nil
end end
end end
@ -205,20 +205,17 @@ describe Google::Auth::UserRefreshCredentials do
needed = %w(client_id client_secret refresh_token) needed = %w(client_id client_secret refresh_token)
needed.each do |missing| needed.each do |missing|
FakeFS do FakeFS do
Dir.mktmpdir do |dir|
FileUtils.mkdir_p(File.dirname(@path)) FileUtils.mkdir_p(File.dirname(@path))
File.write(@path, cred_json_text(missing)) File.write(@path, cred_json_text(missing))
expect { @clz.from_system_default_path(@scope) }. expect { @clz.from_system_default_path(@scope) }
to raise_error RuntimeError .to raise_error RuntimeError
File.delete(@path) File.delete(@path)
end end
end end
end end
end
it 'successfully loads the file when it is present' do it 'successfully loads the file when it is present' do
FakeFS do FakeFS do
Dir.mktmpdir do |dir|
FileUtils.mkdir_p(File.dirname(@path)) FileUtils.mkdir_p(File.dirname(@path))
File.write(@path, cred_json_text) File.write(@path, cred_json_text)
expect(@clz.from_system_default_path(@scope)).to_not be_nil expect(@clz.from_system_default_path(@scope)).to_not be_nil
@ -227,4 +224,3 @@ describe Google::Auth::UserRefreshCredentials do
end end
end end
end end
end