X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a9dcb66e7b835a45902e1257f47be3f625389831..437eb1fa8a518e760d76e51a1ab6ddd20c39ffc9:/test/controllers/notes_controller_test.rb diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index 024380de1..b672a3a3e 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -129,12 +129,12 @@ class NotesControllerTest < ActionDispatch::IntegrationTest end sidebar_browse_check :note_path, note_with_hidden_comment.id, "notes/show" - assert_select "div.note-comments ul li", :count => 1 + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 1 session_for(create(:moderator_user)) sidebar_browse_check :note_path, note_with_hidden_comment.id, "notes/show" - assert_select "div.note-comments ul li", :count => 2 + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 2 end def test_read_note_hidden_user_comment @@ -144,12 +144,12 @@ class NotesControllerTest < ActionDispatch::IntegrationTest end sidebar_browse_check :note_path, note_with_hidden_user_comment.id, "notes/show" - assert_select "div.note-comments ul li", :count => 1 + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 1 session_for(create(:moderator_user)) sidebar_browse_check :note_path, note_with_hidden_user_comment.id, "notes/show" - assert_select "div.note-comments ul li", :count => 1 + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 1 end def test_read_note_hidden_opener @@ -158,7 +158,16 @@ class NotesControllerTest < ActionDispatch::IntegrationTest create(:note_comment, :author => hidden_user, :note => note_with_hidden_opener) sidebar_browse_check :note_path, note_with_hidden_opener.id, "notes/show" - assert_select "div.note-comments ul li", :count => 0 + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 0 + end + + def test_read_note_suspended_opener_and_comment + note = create(:note) + create(:note_comment, :note => note, :author => create(:user, :suspended)) + create(:note_comment, :note => note, :event => "commented") + + sidebar_browse_check :note_path, note.id, "notes/show" + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 1 end def test_read_closed_note @@ -166,16 +175,16 @@ class NotesControllerTest < ActionDispatch::IntegrationTest closed_note = create(:note_with_comments, :closed, :closed_by => user, :comments_count => 2) sidebar_browse_check :note_path, closed_note.id, "notes/show" - assert_select "div.note-comments ul li", :count => 2 - assert_select "div.details", /Resolved by #{user.display_name}/ + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 2 + assert_dom "div.details", /Resolved by #{user.display_name}/ user.soft_destroy! reset! sidebar_browse_check :note_path, closed_note.id, "notes/show" - assert_select "div.note-comments ul li", :count => 1 - assert_select "div.details", /Resolved by deleted/ + assert_dom "article:match('id', ?)", /^c\d+$/, :count => 1 + assert_dom "div.details", /Resolved by deleted/ end def test_new_note_anonymous