Merge branch 'master' into attribute-searching
This commit is contained in:
@@ -27,6 +27,29 @@ class PostApprovalsControllerTest < ActionDispatch::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
context "for an appealed post" do
|
||||
should "undelete the post and mark the appeal as successful" do
|
||||
@appeal = create(:post_appeal)
|
||||
post_auth post_approvals_path(post_id: @appeal.post_id, format: :js), @approver
|
||||
|
||||
assert_response :success
|
||||
assert_equal(false, @appeal.reload.post.is_deleted?)
|
||||
assert_equal(true, @appeal.succeeded?)
|
||||
end
|
||||
end
|
||||
|
||||
context "for a flagged post" do
|
||||
should "approve the post and mark the flag as rejected" do
|
||||
@flag = create(:post_flag)
|
||||
post_auth post_approvals_path(post_id: @flag.post_id, format: :js), @approver
|
||||
|
||||
assert_response :success
|
||||
assert_equal(false, @flag.reload.post.is_deleted?)
|
||||
assert_equal(false, @flag.post.is_flagged?)
|
||||
assert_equal(true, @flag.rejected?)
|
||||
end
|
||||
end
|
||||
|
||||
should "not allow non-approvers to approve posts" do
|
||||
@post = create(:post, is_pending: true)
|
||||
post_auth post_approvals_path(post_id: @post.id, format: :js), create(:user)
|
||||
|
||||
Reference in New Issue
Block a user