From eecd9a183de1342750350fe527feae778e462cd5 Mon Sep 17 00:00:00 2001 From: evazion Date: Thu, 16 Jan 2020 12:16:38 -0600 Subject: [PATCH] comments: add test for undeleting locked comments. ref: #4258, #2728. --- test/functional/comments_controller_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/functional/comments_controller_test.rb b/test/functional/comments_controller_test.rb index c69c40d0a..aa7729ad3 100644 --- a/test/functional/comments_controller_test.rb +++ b/test/functional/comments_controller_test.rb @@ -220,6 +220,18 @@ class CommentsControllerTest < ActionDispatch::IntegrationTest assert_equal(false, @comment.reload.is_deleted) assert_redirected_to(@comment) end + + should "not allow undeleting comments deleted by a moderator" do + @comment = create(:comment, post: @post) + + delete_auth comment_path(@comment.id), @mod + assert_redirected_to @comment + assert(@comment.reload.is_deleted?) + + post_auth undelete_comment_path(@comment.id), @user + assert_response 403 + assert(@comment.reload.is_deleted?) + end end end end