Fix rubocop Ruby 1.9.3 compatibility issues
This commit is contained in:
parent
374b342ea9
commit
1db30f6db1
|
@ -17,3 +17,10 @@ Style/IndentHeredoc:
|
|||
Enabled: false
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
Style/PercentLiteralDelimiters: # Contradicting rule
|
||||
Enabled: false
|
||||
Style/SymbolArray: # Undefined syntax in Ruby 1.9.3
|
||||
Enabled: false
|
||||
|
||||
|
|
2
Rakefile
2
Rakefile
|
@ -10,6 +10,6 @@ desc 'Run rake task'
|
|||
RSpec::Core::RakeTask.new(:spec)
|
||||
|
||||
desc 'Does rubocop lint and runs the specs'
|
||||
task all: %i[rubocop spec]
|
||||
task all: [:rubocop, :spec]
|
||||
|
||||
task default: :all
|
||||
|
|
|
@ -75,7 +75,7 @@ module Google
|
|||
# JSON key.
|
||||
def self.read_json_key(json_key_io)
|
||||
json_key = MultiJson.load(json_key_io.read)
|
||||
wanted = %w[client_id client_secret refresh_token]
|
||||
wanted = %w(client_id client_secret refresh_token)
|
||||
wanted.each do |key|
|
||||
raise "the json is missing the #{key} field" unless json_key.key?(key)
|
||||
end
|
||||
|
|
|
@ -227,7 +227,7 @@ module Google
|
|||
# @param [Rack::Request] request
|
||||
# Current request
|
||||
def self.validate_callback_state(state, request)
|
||||
if state[AUTH_CODE_KEY].nil? # rubocop:disable Style/GuardClause
|
||||
if state[AUTH_CODE_KEY].nil?
|
||||
raise Signet::AuthorizationError, MISSING_AUTH_CODE_ERROR
|
||||
elsif state[ERROR_CODE_KEY]
|
||||
raise Signet::AuthorizationError,
|
||||
|
|
|
@ -70,7 +70,7 @@ describe Google::Auth::ScopeUtil do
|
|||
|
||||
context 'with scope as Array' do
|
||||
let(:source) do
|
||||
%w[email profile openid https://www.googleapis.com/auth/drive]
|
||||
%w(email profile openid https://www.googleapis.com/auth/drive)
|
||||
end
|
||||
it_behaves_like 'normalizes scopes'
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ describe Google::Auth::UserAuthorizer do
|
|||
include TestHelpers
|
||||
|
||||
let(:client_id) { Google::Auth::ClientId.new('testclient', 'notasecret') }
|
||||
let(:scope) { %w[email profile] }
|
||||
let(:scope) { %w(email profile) }
|
||||
let(:token_store) { DummyTokenStore.new }
|
||||
let(:callback_uri) { 'https://www.example.com/oauth/callback' }
|
||||
let(:authorizer) do
|
||||
|
@ -173,7 +173,7 @@ describe Google::Auth::UserAuthorizer do
|
|||
end
|
||||
|
||||
it 'should return credentials with a valid scope' do
|
||||
expect(credentials.scope).to eq %w[email profile]
|
||||
expect(credentials.scope).to eq %w(email profile)
|
||||
end
|
||||
|
||||
it 'should return credentials with a valid expiration time' do
|
||||
|
|
|
@ -115,7 +115,7 @@ describe Google::Auth::UserRefreshCredentials do
|
|||
end
|
||||
|
||||
it 'fails if the GOOGLE_APPLICATION_CREDENTIALS path file is invalid' do
|
||||
needed = %w[client_id client_secret refresh_token]
|
||||
needed = %w(client_id client_secret refresh_token)
|
||||
needed.each do |missing|
|
||||
Dir.mktmpdir do |dir|
|
||||
key_path = File.join(dir, 'my_cert_file')
|
||||
|
@ -169,7 +169,7 @@ describe Google::Auth::UserRefreshCredentials do
|
|||
end
|
||||
|
||||
it 'fails if the file is invalid' do
|
||||
needed = %w[client_id client_secret refresh_token]
|
||||
needed = %w(client_id client_secret refresh_token)
|
||||
needed.each do |missing|
|
||||
Dir.mktmpdir do |dir|
|
||||
key_path = File.join(dir, '.config', @known_path)
|
||||
|
@ -208,7 +208,7 @@ describe Google::Auth::UserRefreshCredentials do
|
|||
end
|
||||
|
||||
it 'fails if the file is invalid' do
|
||||
needed = %w[client_id client_secret refresh_token]
|
||||
needed = %w(client_id client_secret refresh_token)
|
||||
needed.each do |missing|
|
||||
FakeFS do
|
||||
FileUtils.mkdir_p(File.dirname(@path))
|
||||
|
|
|
@ -42,7 +42,7 @@ describe Google::Auth::WebUserAuthorizer do
|
|||
include TestHelpers
|
||||
|
||||
let(:client_id) { Google::Auth::ClientId.new('testclient', 'notasecret') }
|
||||
let(:scope) { %w[email profile] }
|
||||
let(:scope) { %w(email profile) }
|
||||
let(:token_store) { DummyTokenStore.new }
|
||||
let(:authorizer) do
|
||||
Google::Auth::WebUserAuthorizer.new(client_id, scope, token_store)
|
||||
|
|
Loading…
Reference in New Issue