fixes #4080: Status code 500 when disapproving through API

This commit is contained in:
Albert Yi
2019-05-17 12:09:03 -07:00
parent 04edc3f533
commit 0a058dd52b
2 changed files with 10 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ module Moderator
def create
cookies.permanent[:moderated] = Time.now.to_i
@post_disapproval = PostDisapproval.create(post_disapproval_params)
respond_with(@post_disapproval)
respond_with(@post_disapproval, location: moderator_post_disapprovals_path)
end
def index

View File

@@ -18,6 +18,15 @@ module Moderator
end
assert_response :success
end
context "for json" do
should "render" do
assert_difference("PostDisapproval.count", 1) do
post_auth moderator_post_disapprovals_path, @admin, params: { post_disapproval: { post_id: @post.id, reason: "breaks_rules" }, format: "json" }
end
assert_response :success
end
end
end
end
end