]> git.openstreetmap.org Git - rails.git/commitdiff
Test api old way show action without integration
authorAnton Khorev <tony29@yandex.ru>
Sun, 9 Feb 2025 00:27:17 +0000 (03:27 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 10 Feb 2025 19:25:22 +0000 (22:25 +0300)
test/controllers/api/old_ways_controller_test.rb

index 141f9cfa338b91cb8b05a17283eb174e730afaf8..a00dd84cf127a0bbbd90a917b1cdab3a38677e4c 100644 (file)
@@ -80,7 +80,29 @@ module Api
                     "redacted node #{way_v1.way_id} version #{way_v1.version} shouldn't be present in the history, even when logged in."
     end
 
-    # TODO: test_show
+    def test_show
+      way = create(:way, :with_history, :version => 2)
+
+      get api_way_version_path(way, 1)
+
+      assert_response :success
+      assert_dom "osm:root", 1 do
+        assert_dom "> way", 1 do
+          assert_dom "> @id", way.id.to_s
+          assert_dom "> @version", "1"
+        end
+      end
+
+      get api_way_version_path(way, 2)
+
+      assert_response :success
+      assert_dom "osm:root", 1 do
+        assert_dom "> way", 1 do
+          assert_dom "> @id", way.id.to_s
+          assert_dom "> @version", "2"
+        end
+      end
+    end
 
     ##
     # test that redacted ways aren't visible, regardless of