]> git.openstreetmap.org Git - rails.git/blobdiff - test/functional/old_relation_controller_test.rb
Copy the redaction code from nodes to ways
[rails.git] / test / functional / old_relation_controller_test.rb
index b8bf464b6030fd180dced5c4f75dc88efdfed56e..89676a175a8f38872f0455246ab96de4dede3135 100644 (file)
@@ -1,31 +1,32 @@
 require File.dirname(__FILE__) + '/../test_helper'
 require 'old_relation_controller'
 
-# Re-raise errors caught by the controller.
-#class OldRelationController; def rescue_action(e) raise e end; end
-
-class OldRelationControllerTest < Test::Unit::TestCase
+class OldRelationControllerTest < ActionController::TestCase
   api_fixtures
 
-  def setup
-    @controller = OldRelationController.new
-    @request    = ActionController::TestRequest.new
-    @response   = ActionController::TestResponse.new
+  ##
+  # test all routes which lead to this controller
+  def test_routes
+    assert_routing(
+      { :path => "/api/0.6/relation/1/history", :method => :get },
+      { :controller => "old_relation", :action => "history", :id => "1" }
+    )
+    assert_routing(
+      { :path => "/api/0.6/relation/1/2", :method => :get },
+      { :controller => "old_relation", :action => "version", :id => "1", :version => "2" }
+    )
   end
 
   # -------------------------------------
   # Test reading old relations.
   # -------------------------------------
-
   def test_history
     # check that a visible relations is returned properly
-    get :history, :id => relations(:visible_relation).id
+    get :history, :id => relations(:visible_relation).relation_id
     assert_response :success
 
     # check chat a non-existent relations is not returned
     get :history, :id => 0
     assert_response :not_found
-
   end
-
 end