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
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
+ hidden_user = create(:user, :deleted)
+ note_with_hidden_opener = create(:note)
+ create(:note_comment, :author => hidden_user, :note => note_with_hidden_opener)
+
+ sidebar_browse_check :note_path, note_with_hidden_opener.id, "notes/show"
+ 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
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