Skip to content

Commit

Permalink
fix PurgeOldEmailEventJobSpec (timezone bug)
Browse files Browse the repository at this point in the history
  • Loading branch information
maatinito committed Oct 31, 2023
1 parent c45e5a1 commit 8d7668c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/jobs/cron/purge_old_email_event_job_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
RSpec.describe Cron::PurgeOldEmailEventJob, type: :job do
describe 'perform' do
subject { Cron::PurgeOldEmailEventJob.perform_now }
let(:older_than_retention_duration) { create(:email_event, :dolist, created_at: Time.zone.now.utc - (EmailEvent::RETENTION_DURATION + 1.day)) }
let(:more_recent_than_retention_duraiton) { create(:email_event, :dolist, created_at: Time.zone.now.utc - (EmailEvent::RETENTION_DURATION - 1.day)) }
let(:older_than_retention_duration) { create(:email_event, :dolist, created_at: Time.zone.now - (EmailEvent::RETENTION_DURATION + 1.day)) }
let(:more_recent_than_retention_duration) { create(:email_event, :dolist, created_at: Time.zone.now - (EmailEvent::RETENTION_DURATION - 1.day)) }
before do
older_than_retention_duration
more_recent_than_retention_duraiton
more_recent_than_retention_duration
end

it { expect { subject }.to change { EmailEvent.count }.by(-1) }
Expand Down

0 comments on commit 8d7668c

Please sign in to comment.