X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8d2271699bfe8199ebeac2d2bf491e2133cc02d8..5df061f558d8973c519e346812185b142efbd9da:/test/controllers/traces_controller_test.rb diff --git a/test/controllers/traces_controller_test.rb b/test/controllers/traces_controller_test.rb index 364142dd9..1c3dc2d31 100644 --- a/test/controllers/traces_controller_test.rb +++ b/test/controllers/traces_controller_test.rb @@ -133,7 +133,7 @@ class TracesControllerTest < ActionDispatch::IntegrationTest # Check that the index of traces is displayed def test_index user = create(:user) - # The fourth test below is surpisingly sensitive to timestamp ordering when the timestamps are equal. + # The fourth test below is surprisingly sensitive to timestamp ordering when the timestamps are equal. trace_a = create(:trace, :visibility => "public", :timestamp => 4.seconds.ago) do |trace| create(:tracetag, :trace => trace, :tag => "London") end @@ -178,7 +178,7 @@ class TracesControllerTest < ActionDispatch::IntegrationTest # First try to get it when not logged in get traces_mine_path - assert_redirected_to :controller => "users", :action => "login", :referer => "/traces/mine" + assert_redirected_to login_path(:referer => "/traces/mine") session_for(user) @@ -255,7 +255,7 @@ class TracesControllerTest < ActionDispatch::IntegrationTest # Check the RSS feed def test_rss user = create(:user) - # The fourth test below is surpisingly sensitive to timestamp ordering when the timestamps are equal. + # The fourth test below is surprisingly sensitive to timestamp ordering when the timestamps are equal. trace_a = create(:trace, :visibility => "public", :timestamp => 4.seconds.ago) do |trace| create(:tracetag, :trace => trace, :tag => "London") end @@ -541,7 +541,7 @@ class TracesControllerTest < ActionDispatch::IntegrationTest # First with no auth get new_trace_path assert_response :redirect - assert_redirected_to :controller => :users, :action => :login, :referer => new_trace_path + assert_redirected_to login_path(:referer => new_trace_path) # Now authenticated as a user with gps.trace.visibility set user = create(:user) @@ -627,7 +627,7 @@ class TracesControllerTest < ActionDispatch::IntegrationTest # First with no auth get edit_trace_path(:display_name => public_trace_file.user.display_name, :id => public_trace_file) assert_response :redirect - assert_redirected_to :controller => :users, :action => :login, :referer => edit_trace_path(:display_name => public_trace_file.user.display_name, :id => public_trace_file.id) + assert_redirected_to login_path(:referer => edit_trace_path(:display_name => public_trace_file.user.display_name, :id => public_trace_file.id)) # Now with some other user, which should fail session_for(create(:user)) @@ -761,19 +761,19 @@ class TracesControllerTest < ActionDispatch::IntegrationTest assert_response :success assert_template "index" - if !traces.empty? + if traces.empty? + assert_select "h4", /Nothing here yet/ + else assert_select "table#trace_list tbody", :count => 1 do assert_select "tr", :count => traces.length do |rows| traces.zip(rows).each do |trace, row| assert_select row, "a", Regexp.new(Regexp.escape(trace.name)) - assert_select row, "span", Regexp.new(Regexp.escape("(#{trace.size} points)")) if trace.inserted? + assert_select row, "li", Regexp.new(Regexp.escape("#{trace.size} points")) if trace.inserted? assert_select row, "td", Regexp.new(Regexp.escape(trace.description)) assert_select row, "td", Regexp.new(Regexp.escape("by #{trace.user.display_name}")) end end end - else - assert_select "h4", /Nothing here yet/ end end