3 class OldWaysControllerTest < ActionDispatch::IntegrationTest
6 { :path => "/way/1/history/2", :method => :get },
7 { :controller => "old_ways", :action => "show", :id => "1", :version => "2" }
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 assert_select "h4", /^Version/ do
18 assert_select "a[href='#{old_way_path way, 1}']", :count => 0
20 assert_select "a[href='#{way_version_path way, 1}']", :count => 1
23 def test_visible_with_shared_nodes
24 node = create(:node, :with_history)
25 way = create(:way, :with_history)
26 create(:way_node, :way => way, :node => node)
27 create(:old_way_node, :old_way => way.old_ways.first, :node => node)
28 sharing_way = create(:way, :with_history)
29 create(:way_node, :way => sharing_way, :node => node)
30 create(:old_way_node, :old_way => sharing_way.old_ways.first, :node => node)
31 get old_way_path(way, 1)
32 assert_response :success
33 assert_template "old_ways/show"
34 assert_template :layout => "map"
38 way = create(:way, :with_history, :deleted, :version => 2)
39 way_v1 = way.old_ways.find_by(:version => 1)
40 way_v1.redact!(create(:redaction))
41 get old_way_path(way, 1)
42 assert_response :success
43 assert_template "old_ways/show"
44 assert_template :layout => "map"
45 assert_select "a[href='#{old_way_path way, 1}']", :count => 0
46 assert_select "a[href='#{way_version_path way, 1}']", :count => 0
50 get old_way_path(0, 0)
51 assert_response :not_found
52 assert_template "old_ways/not_found"
53 assert_template :layout => "map"
54 assert_select "#sidebar_content", /way #0 version 0 could not be found/