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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user