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