mirror of
https://github.com/discourse/discourse.git
synced 2024-12-14 00:53:51 +08:00
7f2f87bf59
See comments in https://review.discourse.org/t/dev-imap-log-to-database-10435/14337/6 for context.
21 lines
500 B
Ruby
21 lines
500 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Jobs::CleanupImapSyncLog do
|
|
let(:job_class) { Jobs::CleanupImapSyncLog.new }
|
|
|
|
it "deletes logs older than RETAIN_LOGS_DAYS" do
|
|
log1 = ImapSyncLog.log("Test log 1", :debug)
|
|
log2 = ImapSyncLog.log("Test log 2", :debug)
|
|
log3 = ImapSyncLog.log("Test log 3", :debug)
|
|
|
|
log2.update(created_at: 6.days.ago)
|
|
log3.update(created_at: 7.days.ago)
|
|
|
|
job_class.execute({})
|
|
|
|
expect(ImapSyncLog.count).to eq(1)
|
|
end
|
|
end
|