X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/11e97b3edb057f6f449209ca2afd169feda229a4..bc12774c21915687c07b93dbcbef78d28d2920af:/test/controllers/notes_controller_test.rb?ds=inline diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index 6eda7d3a3..50e7ae833 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -13,11 +13,11 @@ class NotesControllerTest < ActionDispatch::IntegrationTest def test_routes assert_routing( { :path => "/user/username/notes", :method => :get }, - { :controller => "notes", :action => "mine", :display_name => "username" } + { :controller => "notes", :action => "index", :display_name => "username" } ) end - def test_mine_success + def test_index_success first_user = create(:user) second_user = create(:user) moderator_user = create(:moderator_user) @@ -33,44 +33,51 @@ class NotesControllerTest < ActionDispatch::IntegrationTest end # Note that the table rows include a header row - get my_notes_path(:display_name => first_user.display_name) + get user_notes_path(:display_name => first_user.display_name) assert_response :success assert_select "table.note_list tr", :count => 2 - get my_notes_path(:display_name => second_user.display_name) + get user_notes_path(:display_name => second_user.display_name) assert_response :success assert_select "table.note_list tr", :count => 2 - get my_notes_path(:display_name => "non-existent") + get user_notes_path(:display_name => "non-existent") assert_response :not_found session_for(moderator_user) - get my_notes_path(:display_name => first_user.display_name) + get user_notes_path(:display_name => first_user.display_name) assert_response :success assert_select "table.note_list tr", :count => 2 - get my_notes_path(:display_name => second_user.display_name) + get user_notes_path(:display_name => second_user.display_name) assert_response :success assert_select "table.note_list tr", :count => 3 - get my_notes_path(:display_name => "non-existent") + get user_notes_path(:display_name => "non-existent") assert_response :not_found end - def test_mine_paged + def test_index_paged user = create(:user) create_list(:note, 50) do |note| create(:note_comment, :note => note, :author => user) end - get my_notes_path(:display_name => user.display_name) + get user_notes_path(:display_name => user.display_name) assert_response :success assert_select "table.note_list tr", :count => 11 - get my_notes_path(:display_name => user.display_name, :page => 2) + get user_notes_path(:display_name => user.display_name, :page => 2) assert_response :success assert_select "table.note_list tr", :count => 11 end + + def test_empty_page + user = create(:user) + get user_notes_path(:display_name => user.display_name) + assert_response :success + assert_select "h4", :html => "No notes" + end end