Show all diary comments to administrators

This commit is contained in:
Andy Allan 2019-06-05 15:52:51 +02:00
parent fdffd22cca
commit 9e158a5d39
4 changed files with 22 additions and 2 deletions

View file

@ -43,4 +43,22 @@ class DiaryEntrySystemTest < ApplicationSystemTestCase
assert_not page.has_content? @deleted_entry.title
end
test "deleted diary comments should be hidden for regular users" do
@deleted_comment = create(:diary_comment, :diary_entry => @diary_entry, :visible => false)
sign_in_as(create(:user))
visit diary_entry_path(@diary_entry.user, @diary_entry)
assert_not page.has_content? @deleted_comment.body
end
test "deleted diary comments should be shown to administrators" do
@deleted_comment = create(:diary_comment, :diary_entry => @diary_entry, :visible => false)
sign_in_as(create(:administrator_user))
visit diary_entry_path(@diary_entry.user, @diary_entry)
assert page.has_content? @deleted_comment.body
end
end