Files
danbooru/test/unit/bulk_update_request_pruner_test.rb
evazion 35d26e92e9 BURs: don't update OP when approving BUR.
When approving or rejecting a BUR, don't edit the OP forum post to add
an EDIT: line stating the request has been approved. Instead just let
the embedded BUR state who it was approved by, and post a reply saying
that the request has been approved.
2020-12-03 17:15:24 -06:00

26 lines
1.0 KiB
Ruby

require 'test_helper'
class BulkUpdateRequestPrunerTest < ActiveSupport::TestCase
context '#warn_old' do
should "update the forum topic for a bulk update request" do
forum_topic = as(create(:user)) { create(:forum_topic) }
bur = create(:bulk_update_request, status: "pending", forum_topic: forum_topic, created_at: (TagRelationship::EXPIRY_WARNING + 1).days.ago)
BulkUpdateRequestPruner.warn_old
assert_equal("pending", bur.reload.status)
assert_match(/pending automatic rejection/, ForumPost.last.body)
end
end
context '#reject_expired' do
should "reject the bulk update request" do
forum_topic = as(create(:user)) { create(:forum_topic) }
bur = create(:bulk_update_request, status: "pending", forum_topic: forum_topic, created_at: (TagRelationship::EXPIRY + 1).days.ago)
BulkUpdateRequestPruner.reject_expired
assert_equal("rejected", bur.reload.status)
assert_match(/rejected because it was not approved within 60 days/, ForumPost.second.body)
end
end
end