Files
danbooru/test/functional/post_approvals_controller_test.rb
evazion faf852d18e approvals: remove post undelete endpoint.
Remove `POST /moderator/post/undelete` endpoint. Replace it with
`POST /post_approvals` instead.

Fixes it so that undeleting a post has the same behavior as approving a
post. Namely, it reloads the page instead of just flashing a "Post was
undeleted" message.
2020-02-20 15:49:31 -06:00

40 lines
1.0 KiB
Ruby

require 'test_helper'
class PostApprovalsControllerTest < ActionDispatch::IntegrationTest
context "The post approvals controller" do
setup do
@approver = create(:approver)
end
context "create action" do
context "for a pending post" do
should "approve the post" do
@post = create(:post, is_pending: true)
post_auth post_approvals_path(post_id: @post.id, format: :js), @approver
assert_response :success
assert(!@post.reload.is_pending?)
end
end
context "for a deleted post" do
should "undelete the post" do
@post = create(:post, is_deleted: true)
post_auth post_approvals_path(post_id: @post.id, format: :js), @approver
assert_response :success
assert(!@post.reload.is_deleted?)
end
end
end
context "index action" do
should "render" do
@approval = create(:post_approval)
get post_approvals_path
assert_response :success
end
end
end
end