Add and apply Style/HashTransformValues rule

The `transform_values` method is available since Ruby 2.5.
This commit is contained in:
Javi Martín
2021-08-11 20:34:44 +02:00
parent 5b00df0565
commit 53aa1770a2
2 changed files with 4 additions and 3 deletions

View File

@@ -475,6 +475,9 @@ Style/HashConversion:
Style/HashSyntax: Style/HashSyntax:
Enabled: true Enabled: true
Style/HashTransformValues:
Enabled: true
Style/IdenticalConditionalBranches: Style/IdenticalConditionalBranches:
Enabled: true Enabled: true

View File

@@ -1,8 +1,6 @@
shared_examples "remotely_translatable" do |factory_name, path_name, path_arguments| shared_examples "remotely_translatable" do |factory_name, path_name, path_arguments|
let(:arguments) do let(:arguments) do
path_arguments.map do |argument_name, path_to_value| path_arguments.transform_values { |path_to_value| resource.send(path_to_value) }
[argument_name, resource.send(path_to_value)]
end.to_h
end end
let(:path) { send(path_name, arguments) } let(:path) { send(path_name, arguments) }
let!(:resource) { create(factory_name) } let!(:resource) { create(factory_name) }