]> git.openstreetmap.org Git - rails.git/commitdiff
Simplify element multi fetch paths in api tests
authorAnton Khorev <tony29@yandex.ru>
Tue, 2 Apr 2024 11:36:29 +0000 (14:36 +0300)
committerAnton Khorev <tony29@yandex.ru>
Tue, 2 Apr 2024 11:36:29 +0000 (14:36 +0300)
test/controllers/api/nodes_controller_test.rb
test/controllers/api/relations_controller_test.rb
test/controllers/api/ways_controller_test.rb

index 7becffddcdd849f260200fc444dbb1f267d8dc12..e1da1e946c640158c6d0b3fafb470ad8256b7da8 100644 (file)
@@ -456,11 +456,11 @@ module Api
       assert_response :bad_request
 
       # check error when no parameter value provided
-      get nodes_path, :params => { :nodes => "" }
+      get nodes_path(:nodes => "")
       assert_response :bad_request
 
       # test a working call
-      get nodes_path, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}" }
+      get nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}")
       assert_response :success
       assert_select "osm" do
         assert_select "node", :count => 5
@@ -472,7 +472,7 @@ module Api
       end
 
       # test a working call with json format
-      get nodes_path, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}", :format => "json" }
+      get nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id}", :format => "json")
 
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -485,7 +485,7 @@ module Api
       assert_equal 1, (js["elements"].count { |a| a["id"] == node5.id && a["visible"] == false })
 
       # check error when a non-existent node is included
-      get nodes_path, :params => { :nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0" }
+      get nodes_path(:nodes => "#{node1.id},#{node2.id},#{node3.id},#{node4.id},#{node5.id},0")
       assert_response :not_found
     end
 
index 7ff369fa4abdd73590572a07e0d0b21d96ef04d9..4a6d55efbfc1174b2aa047f27f809210564905e1 100644 (file)
@@ -178,11 +178,11 @@ module Api
       assert_response :bad_request
 
       # check error when no parameter value provided
-      get relations_path, :params => { :relations => "" }
+      get relations_path(:relations => "")
       assert_response :bad_request
 
       # test a working call
-      get relations_path, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}" }
+      get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}")
       assert_response :success
       assert_select "osm" do
         assert_select "relation", :count => 4
@@ -193,7 +193,7 @@ module Api
       end
 
       # test a working call with json format
-      get relations_path, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}", :format => "json" }
+      get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id}", :format => "json")
 
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -205,7 +205,7 @@ module Api
       assert_equal 1, (js["elements"].count { |a| a["id"] == relation4.id && a["visible"].nil? })
 
       # check error when a non-existent relation is included
-      get relations_path, :params => { :relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0" }
+      get relations_path(:relations => "#{relation1.id},#{relation2.id},#{relation3.id},#{relation4.id},0")
       assert_response :not_found
     end
 
index 791da8029f8725e4a6209267641155f9610120ba..c5c3c0e8aedffc62fcc97ee69e953d2a03434e6e 100644 (file)
@@ -102,11 +102,11 @@ module Api
       assert_response :bad_request
 
       # check error when no parameter value provided
-      get ways_path, :params => { :ways => "" }
+      get ways_path(:ways => "")
       assert_response :bad_request
 
       # test a working call
-      get ways_path, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}" }
+      get ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}")
       assert_response :success
       assert_select "osm" do
         assert_select "way", :count => 4
@@ -117,7 +117,7 @@ module Api
       end
 
       # test a working call with json format
-      get ways_path, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}", :format => "json" }
+      get ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id}", :format => "json")
 
       js = ActiveSupport::JSON.decode(@response.body)
       assert_not_nil js
@@ -129,7 +129,7 @@ module Api
       assert_equal 1, (js["elements"].count { |a| a["id"] == way4.id && a["visible"].nil? })
 
       # check error when a non-existent way is included
-      get ways_path, :params => { :ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0" }
+      get ways_path(:ways => "#{way1.id},#{way2.id},#{way3.id},#{way4.id},0")
       assert_response :not_found
     end