From c2159c5d0069acace5799f8b7702fb8c0beb7d68 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 10 Jul 2025 04:08:45 +0300 Subject: [PATCH] Create api elements test helper module --- test/controllers/api/elements_test_helper.rb | 11 +++++++++++ test/controllers/api/nodes_controller_test.rb | 9 +++------ test/controllers/api/relations_controller_test.rb | 9 +++------ test/controllers/api/ways_controller_test.rb | 9 +++------ 4 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 test/controllers/api/elements_test_helper.rb diff --git a/test/controllers/api/elements_test_helper.rb b/test/controllers/api/elements_test_helper.rb new file mode 100644 index 000000000..d36337396 --- /dev/null +++ b/test/controllers/api/elements_test_helper.rb @@ -0,0 +1,11 @@ +module Api + module ElementsTestHelper + private + + ## + # update the changeset_id of a node element + def update_changeset(xml, changeset_id) + xml_attr_rewrite(xml, "changeset", changeset_id) + end + end +end diff --git a/test/controllers/api/nodes_controller_test.rb b/test/controllers/api/nodes_controller_test.rb index 95cd06fb6..f300c171a 100644 --- a/test/controllers/api/nodes_controller_test.rb +++ b/test/controllers/api/nodes_controller_test.rb @@ -1,7 +1,10 @@ require "test_helper" +require_relative "elements_test_helper" module Api class NodesControllerTest < ActionDispatch::IntegrationTest + include ElementsTestHelper + ## # test all routes which lead to this controller def test_routes @@ -640,12 +643,6 @@ module Api private - ## - # update the changeset_id of a node element - def update_changeset(xml, changeset_id) - xml_attr_rewrite(xml, "changeset", changeset_id) - end - ## # update an attribute in the node element def xml_attr_rewrite(xml, name, value) diff --git a/test/controllers/api/relations_controller_test.rb b/test/controllers/api/relations_controller_test.rb index 79ba46a58..fc35d0ffd 100644 --- a/test/controllers/api/relations_controller_test.rb +++ b/test/controllers/api/relations_controller_test.rb @@ -1,7 +1,10 @@ require "test_helper" +require_relative "elements_test_helper" module Api class RelationsControllerTest < ActionDispatch::IntegrationTest + include ElementsTestHelper + ## # test all routes which lead to this controller def test_routes @@ -756,12 +759,6 @@ module Api private - ## - # update the changeset_id of a node element - def update_changeset(xml, changeset_id) - xml_attr_rewrite(xml, "changeset", changeset_id) - end - ## # update an attribute in the node element def xml_attr_rewrite(xml, name, value) diff --git a/test/controllers/api/ways_controller_test.rb b/test/controllers/api/ways_controller_test.rb index 4a5c3c84f..c0ab18e24 100644 --- a/test/controllers/api/ways_controller_test.rb +++ b/test/controllers/api/ways_controller_test.rb @@ -1,7 +1,10 @@ require "test_helper" +require_relative "elements_test_helper" module Api class WaysControllerTest < ActionDispatch::IntegrationTest + include ElementsTestHelper + ## # test all routes which lead to this controller def test_routes @@ -967,12 +970,6 @@ module Api private - ## - # update the changeset_id of a way element - def update_changeset(xml, changeset_id) - xml_attr_rewrite(xml, "changeset", changeset_id) - end - ## # update an attribute in the way element def xml_attr_rewrite(xml, name, value) -- 2.39.5