Add and apply Style/MapToHash rubocop rule

This rule was added in Rubocop 1.24.0. Applying it slightly simplifies
the code.
This commit is contained in:
Javi Martín
2022-08-25 22:24:36 +02:00
parent 5ec7f4a339
commit 4a851c0d82
7 changed files with 16 additions and 13 deletions

View File

@@ -9,9 +9,9 @@ describe "Admin edit translatable records", :admin do
let(:fields) { translatable.translated_attribute_names }
let(:attributes) do
fields.product(%i[en es]).map do |field, locale|
fields.product(%i[en es]).to_h do |field, locale|
[:"#{field}_#{locale}", text_for(field, locale)]
end.to_h
end
end
context "Add a translation" do

View File

@@ -182,9 +182,9 @@ describe "Public area translatable records" do
before { translatable.update(attributes.merge(author: user)) }
let(:attributes) do
translatable.translated_attribute_names.product(%i[en es]).map do |field, locale|
translatable.translated_attribute_names.product(%i[en es]).to_h do |field, locale|
[:"#{field}_#{locale}", text_for(field, locale)]
end.to_h
end
end
context "Update a translation" do