maintenance: fix post pruning test.
Test mistakenly passed because we used `assert(a, b)` instead of `assert_equal(a, b)`.
This commit is contained in:
@@ -6,7 +6,7 @@ module DanbooruMaintenance
|
||||
end
|
||||
|
||||
def daily
|
||||
safely { PostPruner.new.prune! }
|
||||
safely { PostPruner.prune! }
|
||||
safely { Delayed::Job.where('created_at < ?', 45.days.ago).delete_all }
|
||||
safely { PostDisapproval.prune! }
|
||||
safely { regenerate_post_counts! }
|
||||
|
||||
@@ -7,13 +7,20 @@ class DanbooruMaintenanceTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "prune expired posts" do
|
||||
@pending = FactoryBot.create(:post, is_pending: true, created_at: 4.days.ago)
|
||||
@flagged = FactoryBot.create(:post, is_flagged: true, created_at: 4.days.ago)
|
||||
@pending = create(:post, is_pending: true, created_at: 5.days.ago)
|
||||
@flagged = create(:post, is_flagged: true, created_at: 5.days.ago)
|
||||
@appealed = create(:post, is_deleted: true, created_at: 5.days.ago)
|
||||
|
||||
@flag = create(:post_flag, post: @flagged, created_at: 4.days.ago)
|
||||
@appeal = create(:post_appeal, post: @appealed, created_at: 4.days.ago)
|
||||
|
||||
DanbooruMaintenance.daily
|
||||
|
||||
assert(true, @pending.reload.is_deleted)
|
||||
assert(true, @flagged.reload.is_deleted)
|
||||
assert_equal(true, @pending.reload.is_deleted?)
|
||||
assert_equal(true, @flagged.reload.is_deleted?)
|
||||
assert_equal(true, @appealed.reload.is_deleted?)
|
||||
assert_equal(true, @flag.reload.succeeded?)
|
||||
assert_equal(true, @appeal.reload.rejected?)
|
||||
end
|
||||
|
||||
context "when pruning bans" do
|
||||
|
||||
Reference in New Issue
Block a user