]> git.openstreetmap.org Git - rails.git/blob - test/functional/old_relation_controller_test.rb
Add routing tests for all supported routes
[rails.git] / test / functional / old_relation_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'old_relation_controller'
3
4 class OldRelationControllerTest < ActionController::TestCase
5   api_fixtures
6
7   ##
8   # test all routes which lead to this controller
9   def test_routes
10     assert_routing(
11       { :path => "/api/0.6/relation/1/history", :method => :get },
12       { :controller => "old_relation", :action => "history", :id => "1" }
13     )
14     assert_routing(
15       { :path => "/api/0.6/relation/1/2", :method => :get },
16       { :controller => "old_relation", :action => "version", :id => "1", :version => "2" }
17     )
18   end
19
20   # -------------------------------------
21   # Test reading old relations.
22   # -------------------------------------
23   def test_history
24     # check that a visible relations is returned properly
25     get :history, :id => relations(:visible_relation).relation_id
26     assert_response :success
27
28     # check chat a non-existent relations is not returned
29     get :history, :id => 0
30     assert_response :not_found
31   end
32 end