]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/relations_controller_test.rb
Split api node show test
[rails.git] / test / controllers / api / relations_controller_test.rb
index 5147d851f2a5bcddbc1108abedb45ee6b00eaf56..040062153013d2167ce8f1296a11787df9f5d0d7 100644 (file)
@@ -17,14 +17,6 @@ module Api
         { :path => "/api/0.6/relations", :method => :post },
         { :controller => "api/relations", :action => "create" }
       )
-      assert_routing(
-        { :path => "/api/0.6/relation/1/full", :method => :get },
-        { :controller => "api/relations", :action => "full", :id => "1" }
-      )
-      assert_routing(
-        { :path => "/api/0.6/relation/1/full.json", :method => :get },
-        { :controller => "api/relations", :action => "full", :id => "1", :format => "json" }
-      )
       assert_routing(
         { :path => "/api/0.6/relation/1", :method => :get },
         { :controller => "api/relations", :action => "show", :id => "1" }
@@ -33,13 +25,21 @@ module Api
         { :path => "/api/0.6/relation/1.json", :method => :get },
         { :controller => "api/relations", :action => "show", :id => "1", :format => "json" }
       )
+      assert_routing(
+        { :path => "/api/0.6/relation/1/full", :method => :get },
+        { :controller => "api/relations", :action => "full", :id => "1" }
+      )
+      assert_routing(
+        { :path => "/api/0.6/relation/1/full.json", :method => :get },
+        { :controller => "api/relations", :action => "full", :id => "1", :format => "json" }
+      )
       assert_routing(
         { :path => "/api/0.6/relation/1", :method => :put },
         { :controller => "api/relations", :action => "update", :id => "1" }
       )
       assert_routing(
         { :path => "/api/0.6/relation/1", :method => :delete },
-        { :controller => "api/relations", :action => "delete", :id => "1" }
+        { :controller => "api/relations", :action => "destroy", :id => "1" }
       )
 
       assert_routing(
@@ -122,18 +122,35 @@ module Api
     # Test showing relations.
     # -------------------------------------
 
+    def test_show_not_found
+      get api_relation_path(0)
+      assert_response :not_found
+    end
+
+    def test_show_deleted
+      get api_relation_path(create(:relation, :deleted))
+      assert_response :gone
+    end
+
     def test_show
-      # check that a visible relation is returned properly
       get api_relation_path(create(:relation))
       assert_response :success
+    end
 
-      # check that an invisible relation is not returned
-      get api_relation_path(create(:relation, :deleted))
+    def test_full_not_found
+      get relation_full_path(999999)
+      assert_response :not_found
+    end
+
+    def test_full_deleted
+      get relation_full_path(create(:relation, :deleted))
       assert_response :gone
+    end
 
-      # check chat a non-existent relation is not returned
-      get api_relation_path(0)
-      assert_response :not_found
+    def test_full_empty
+      get relation_full_path(create(:relation))
+      assert_response :success
+      # FIXME: check whether this contains the stuff we want!
     end
 
     ##
@@ -201,19 +218,6 @@ module Api
                                   [relation_with_relation, second_relation])
     end
 
-    def test_full
-      # check the "full" mode
-      get relation_full_path(:id => 999999)
-      assert_response :not_found
-
-      get relation_full_path(:id => create(:relation, :deleted).id)
-      assert_response :gone
-
-      get relation_full_path(:id => create(:relation).id)
-      assert_response :success
-      # FIXME: check whether this contains the stuff we want!
-    end
-
     # -------------------------------------
     # Test simple relation creation.
     # -------------------------------------
@@ -509,7 +513,7 @@ module Api
     # Test deleting relations.
     # -------------------------------------
 
-    def test_delete
+    def test_destroy
       private_user = create(:user, :data_public => false)
       private_user_closed_changeset = create(:changeset, :closed, :user => private_user)
       user = create(:user)