]> git.openstreetmap.org Git - rails.git/blob - test/controllers/old_relations_controller_test.rb
Add relation version pages
[rails.git] / test / controllers / old_relations_controller_test.rb
1 require "test_helper"
2
3 class OldRelationsControllerTest < ActionDispatch::IntegrationTest
4   def test_routes
5     assert_routing(
6       { :path => "/relation/1/history/2", :method => :get },
7       { :controller => "old_relations", :action => "show", :id => "1", :version => "2" }
8     )
9   end
10
11   def test_visible
12     relation = create(:relation, :with_history)
13     get old_relation_path(relation, 1)
14     assert_response :success
15     assert_template "old_relations/show"
16     assert_template :layout => "map"
17   end
18
19   def test_visible_with_members
20     relation = create(:relation, :with_history)
21     create(:old_relation_member, :old_relation => relation.old_relations.first)
22     get old_relation_path(relation, 1)
23     assert_response :success
24     assert_template "old_relations/show"
25     assert_template :layout => "map"
26   end
27
28   def test_not_found
29     get old_relation_path(0, 0)
30     assert_response :not_found
31     assert_template "old_relations/not_found"
32     assert_template :layout => "map"
33     assert_select "#sidebar_content", /relation #0 version 0 could not be found/
34   end
35 end