From 4932c08be6c545efbbf0e30be97a6602a7e418df Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 5 Aug 2025 17:58:16 +0100 Subject: [PATCH] Fix new rubocop warnings --- test/controllers/api/maps_controller_test.rb | 10 +++++----- test/controllers/api/nodes_controller_test.rb | 12 ++++++------ test/controllers/api/relations_controller_test.rb | 10 +++++----- test/controllers/api/ways_controller_test.rb | 10 +++++----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/test/controllers/api/maps_controller_test.rb b/test/controllers/api/maps_controller_test.rb index bd39a8f43..1c1b9b6a3 100644 --- a/test/controllers/api/maps_controller_test.rb +++ b/test/controllers/api/maps_controller_test.rb @@ -186,11 +186,11 @@ module Api result_node = result_nodes.first assert_equal result_node["tags"], tag.k => tag.v - assert_equal 2, (js["elements"].count { |a| a["type"] == "way" }) - assert_equal 1, (js["elements"].count { |a| a["type"] == "way" && a["id"] == way1.id }) - assert_equal 1, (js["elements"].count { |a| a["type"] == "way" && a["id"] == way2.id }) - assert_equal 1, (js["elements"].count { |a| a["type"] == "relation" }) - assert_equal 1, (js["elements"].count { |a| a["type"] == "relation" && a["id"] == relation.id }) + assert_equal(2, js["elements"].count { |a| a["type"] == "way" }) + assert_equal(1, js["elements"].count { |a| a["type"] == "way" && a["id"] == way1.id }) + assert_equal(1, js["elements"].count { |a| a["type"] == "way" && a["id"] == way2.id }) + assert_equal(1, js["elements"].count { |a| a["type"] == "relation" }) + assert_equal(1, js["elements"].count { |a| a["type"] == "relation" && a["id"] == relation.id }) end # This differs from the above test in that we are making the bbox exactly diff --git a/test/controllers/api/nodes_controller_test.rb b/test/controllers/api/nodes_controller_test.rb index 296942e96..b1f6ff2de 100644 --- a/test/controllers/api/nodes_controller_test.rb +++ b/test/controllers/api/nodes_controller_test.rb @@ -78,12 +78,12 @@ module Api js = ActiveSupport::JSON.decode(@response.body) assert_not_nil js assert_equal 5, js["elements"].count - assert_equal 5, (js["elements"].count { |a| a["type"] == "node" }) - assert_equal 1, (js["elements"].count { |a| a["id"] == node1.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == node2.id && a["visible"] == false }) - assert_equal 1, (js["elements"].count { |a| a["id"] == node3.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == node4.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false }) + assert_equal(5, js["elements"].count { |a| a["type"] == "node" }) + assert_equal(1, js["elements"].count { |a| a["id"] == node1.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == node2.id && a["visible"] == false }) + assert_equal(1, js["elements"].count { |a| a["id"] == node3.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == node4.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false }) # check error when a non-existent node is included get api_nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0") diff --git a/test/controllers/api/relations_controller_test.rb b/test/controllers/api/relations_controller_test.rb index 025d67e8f..3f9b44389 100644 --- a/test/controllers/api/relations_controller_test.rb +++ b/test/controllers/api/relations_controller_test.rb @@ -85,11 +85,11 @@ module Api js = ActiveSupport::JSON.decode(@response.body) assert_not_nil js assert_equal 4, js["elements"].count - assert_equal 4, (js["elements"].count { |a| a["type"] == "relation" }) - assert_equal 1, (js["elements"].count { |a| a["id"] == relation1.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == relation2.id && a["visible"] == false }) - assert_equal 1, (js["elements"].count { |a| a["id"] == relation3.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? }) + assert_equal(4, js["elements"].count { |a| a["type"] == "relation" }) + assert_equal(1, js["elements"].count { |a| a["id"] == relation1.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == relation2.id && a["visible"] == false }) + assert_equal(1, js["elements"].count { |a| a["id"] == relation3.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? }) # check error when a non-existent relation is included get api_relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0") diff --git a/test/controllers/api/ways_controller_test.rb b/test/controllers/api/ways_controller_test.rb index c476ebf27..1e8e9289a 100644 --- a/test/controllers/api/ways_controller_test.rb +++ b/test/controllers/api/ways_controller_test.rb @@ -84,11 +84,11 @@ module Api js = ActiveSupport::JSON.decode(@response.body) assert_not_nil js assert_equal 4, js["elements"].count - assert_equal 4, (js["elements"].count { |a| a["type"] == "way" }) - assert_equal 1, (js["elements"].count { |a| a["id"] == way1.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == way2.id && a["visible"] == false }) - assert_equal 1, (js["elements"].count { |a| a["id"] == way3.id && a["visible"].nil? }) - assert_equal 1, (js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? }) + assert_equal(4, js["elements"].count { |a| a["type"] == "way" }) + assert_equal(1, js["elements"].count { |a| a["id"] == way1.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == way2.id && a["visible"] == false }) + assert_equal(1, js["elements"].count { |a| a["id"] == way3.id && a["visible"].nil? }) + assert_equal(1, js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? }) # check error when a non-existent way is included get api_ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0") -- 2.39.5