mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:03:22 +08:00
493d437e79
* Remove outdated option
04078317ba
* Use the non-globally exposed RSpec syntax
https://github.com/rspec/rspec-core/pull/2803
* Use the non-globally exposed RSpec syntax, cont
https://github.com/rspec/rspec-core/pull/2803
* Comply to strict predicate matchers
See:
- https://github.com/rspec/rspec-expectations/pull/1195
- https://github.com/rspec/rspec-expectations/pull/1196
- https://github.com/rspec/rspec-expectations/pull/1277
24 lines
644 B
Ruby
24 lines
644 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.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
|
|
|
|
it "does not write the log to the db if specified" do
|
|
ImapSyncLog.debug("test", Fabricate(:group), db: false)
|
|
expect(ImapSyncLog.count).to eq(0)
|
|
end
|
|
end
|