]> git.openstreetmap.org Git - rails.git/blob - test/controllers/ways_controller_test.rb
Fixed "Tab alignment" issue described in #4773
[rails.git] / test / controllers / ways_controller_test.rb
1 require "test_helper"
2
3 class WaysControllerTest < ActionDispatch::IntegrationTest
4   ##
5   # test all routes which lead to this controller
6   def test_routes
7     assert_routing(
8       { :path => "/way/1", :method => :get },
9       { :controller => "ways", :action => "show", :id => "1" }
10     )
11   end
12
13   def test_show
14     way = create(:way)
15     sidebar_browse_check :way_path, way.id, "browse/feature"
16     assert_select "h4", /^Version/ do
17       assert_select "a[href='#{old_way_path way, 1}']", :text => "1", :count => 1
18     end
19     assert_select ".secondary-actions a[href='#{api_way_path way}']", :count => 1
20     assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
21     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 0
22   end
23
24   def test_show_multiple_versions
25     way = create(:way, :with_history, :version => 2)
26     sidebar_browse_check :way_path, way.id, "browse/feature"
27     assert_select ".secondary-actions a[href='#{way_history_path way}']", :count => 1
28     assert_select ".secondary-actions a[href='#{old_way_path way, 1}']", :count => 1
29     assert_select ".secondary-actions a[href='#{old_way_path way, 2}']", :count => 1
30   end
31
32   def test_show_relation_member
33     member = create(:way)
34     relation = create(:relation)
35     create(:relation_member, :relation => relation, :member => member)
36     sidebar_browse_check :way_path, member.id, "browse/feature"
37     assert_select "a[href='#{relation_path relation}']", :count => 1
38   end
39 end