Skip to content

Commit

Permalink
Fix rubocop errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrharpo committed Jan 12, 2023
1 parent d11c1ff commit 689ca21
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
8 changes: 8 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
AllCops:
TargetRubyVersion: 2.4+
DisplayCopNames: true
Exclude:
- 'db/**/*.rb'
Expand Down Expand Up @@ -33,6 +34,10 @@ Style/Documentation:
Layout/LineLength:
Enabled: false

Metrics/BlockLength:
Max: 50
IgnoredMethods: ['describe', 'context']

Metrics/MethodLength:
Enabled: false

Expand Down Expand Up @@ -92,6 +97,9 @@ Style/GuardClause:
Exclude:
- 'spec/support/remote_ip_monkey_patch.rb'

Lint/DuplicateMethods:
Enabled: false

# Offense count: 2
Lint/ShadowingOuterLocalVariable:
Exclude:
Expand Down
28 changes: 14 additions & 14 deletions spec/sony_ci_api/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ def stub_request_and_call_block(http_method, path, with: {}, stub_response: {})
return_val
end

# Create some dummy class available in a global scope that can be
# recognized by ERB within SonyCiApi::Client#load_config!
class TestCredentials
def self.config_hash
@config_hash ||= {
username: rand(9999).to_s,
password: rand(9999).to_s,
workspace_id: rand(9999).to_s,
client_id: rand(9999).to_s,
client_secret: rand(9999).to_s
}
end
end

RSpec.describe SonyCiApi::Client do
def randhex(len = 32)
len.times.map { rand(15).to_s(16) }.join
Expand Down Expand Up @@ -530,20 +544,6 @@ def camelize_params(**params)
valid_config_file.write(config_hash.to_yaml) && valid_config_file.rewind
valid_config_file_erb.write(config_hash_with_erb.to_yaml) && valid_config_file_erb.rewind
invalid_config_file.write(':') && invalid_config_file.rewind

# Create some dummy class available in a global scope that can be
# recognized by ERB within SonyCiApi::Client#load_config!
class TestCredentials
def self.config_hash
@config_hash ||= {
username: rand(9999).to_s,
password: rand(9999).to_s,
workspace_id: rand(9999).to_s,
client_id: rand(9999).to_s,
client_secret: rand(9999).to_s
}
end
end
end

after do
Expand Down
2 changes: 1 addition & 1 deletion spec/sony_ci_api/error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
expected_mappings.each do |faraday_error_class, expected_error_class|
# Create an instance of the Faraday error class. Use nil message and
# empty response because we don't need those, but Faraday classes do.
faraday_error = faraday_error_class.new(nil, {})
faraday_error_class.new(nil, {})
new_error = described_class.create_from(faraday_error_class.new(nil, {}))
expect(new_error).to be_a expected_error_class
end
Expand Down

0 comments on commit 689ca21

Please sign in to comment.