Skip to content

Commit b4207d2

Browse files
committed
Autocorrect rubocop violations
https://buildkite.com/rails/rails/builds/111156#0191d93b-1a10-4283-9109-f66bb815ba68 ``` % be rubocop -A activemodel/test/cases/serializers/json_serialization_test.rb Inspecting 1 file C Offenses: activemodel/test/cases/serializers/json_serialization_test.rb:174:18: C: [Corrected] Minitest/LiteralAsActualArgument: Replace the literal with the first argument. assert_equal json, { "name" => "Konata Izumi" } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ activemodel/test/cases/serializers/json_serialization_test.rb:181:18: C: [Corrected] Minitest/LiteralAsActualArgument: Replace the literal with the first argument. assert_equal json, { "name" => "Konata Izumi" } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ activemodel/test/cases/serializers/json_serialization_test.rb:213:18: C: [Corrected] Minitest/LiteralAsActualArgument: Replace the literal with the first argument. assert_equal json["address"], { "city" => "Trichy" } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ activemodel/test/cases/serializers/json_serialization_test.rb:223:18: C: [Corrected] Minitest/LiteralAsActualArgument: Replace the literal with the first argument. assert_equal json["address"], { "city" => "Trichy" } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 4 offenses detected, 4 offenses corrected ```
1 parent 1016673 commit b4207d2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

activemodel/test/cases/serializers/json_serialization_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ def @contact.favorite_quote; "Constraints are liberating"; end
171171
json = @contact.as_json(except: [:age, :created_at, :awesome, :preferences])
172172

173173
assert_kind_of Hash, json
174-
assert_equal json, { "name" => "Konata Izumi" }
174+
assert_equal({ "name" => "Konata Izumi" }, json)
175175
end
176176

177177
test "as_json should allow attribute filtering with only" do
178178
json = @contact.as_json(only: :name)
179179

180180
assert_kind_of Hash, json
181-
assert_equal json, { "name" => "Konata Izumi" }
181+
assert_equal({ "name" => "Konata Izumi" }, json)
182182
end
183183

184184
test "as_json should work with methods options" do
@@ -210,7 +210,7 @@ def @contact.favorite_quote; "Constraints are liberating"; end
210210
%w(name age created_at awesome preferences).each do |field|
211211
assert_equal @contact.public_send(field).as_json, json[field]
212212
end
213-
assert_equal json["address"], { "city" => "Trichy" }
213+
assert_equal({ "city" => "Trichy" }, json["address"])
214214
end
215215

216216
test "as_json should work with include option paired with except filter" do
@@ -220,7 +220,7 @@ def @contact.favorite_quote; "Constraints are liberating"; end
220220
%w(name age created_at awesome preferences).each do |field|
221221
assert_equal @contact.public_send(field).as_json, json[field]
222222
end
223-
assert_equal json["address"], { "city" => "Trichy" }
223+
assert_equal({ "city" => "Trichy" }, json["address"])
224224
end
225225

226226
test "from_json should work without a root (class attribute)" do

0 commit comments

Comments
 (0)