FIX: Category topics should not be deletable via review queue

This commit is contained in:
Robin Ward
2019-05-30 16:43:23 -04:00
parent 0f3c3bc309
commit 2e0a40007b
5 changed files with 47 additions and 3 deletions
@@ -185,6 +185,36 @@ RSpec.describe Admin::UsersController do
expect(response.status).to eq(200)
end
it "won't delete a category topic" do
c = Fabricate(:category)
cat_post = c.topic.posts.first
put(
"/admin/users/#{user.id}/suspend.json",
params: suspend_params.merge(
post_action: 'delete',
post_id: cat_post.id
)
)
cat_post.reload
expect(cat_post.deleted_at).to be_blank
expect(response.status).to eq(200)
end
it "won't delete a category topic by replies" do
c = Fabricate(:category)
cat_post = c.topic.posts.first
put(
"/admin/users/#{user.id}/suspend.json",
params: suspend_params.merge(
post_action: 'delete_replies',
post_id: cat_post.id
)
)
cat_post.reload
expect(cat_post.deleted_at).to be_blank
expect(response.status).to eq(200)
end
it "can delete an associated post and its replies" do
reply = PostCreator.create(
Fabricate(:user),