Merge pull request #4964 from tchak/fix-expiration-tests

Use bigger deltas to allow for month length variations
This commit is contained in:
Paul Chavard 2020-03-31 12:01:17 +02:00 committed by GitHub
commit 44ec4a739c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,14 +106,14 @@ describe ExpiredDossiersDeletionService do
end
context 'when a notice has been sent not so long ago' do
let(:notice_sent_at) { (warning_period - 1.day).ago }
let(:notice_sent_at) { (warning_period - 4.days).ago }
it { expect { dossier.reload }.not_to raise_error }
it { expect(DossierMailer).not_to have_received(:notify_brouillon_deletion) }
end
context 'when a notice has been sent a long time ago' do
let(:notice_sent_at) { (warning_period + 1.day).ago }
let(:notice_sent_at) { (warning_period + 4.days).ago }
it { expect { dossier.reload }.to raise_error(ActiveRecord::RecordNotFound) }
@ -233,7 +233,7 @@ describe ExpiredDossiersDeletionService do
end
context 'when a notice has been sent not so long ago' do
let(:notice_sent_at) { (warning_period - 1.day).ago }
let(:notice_sent_at) { (warning_period - 4.days).ago }
it { expect { dossier.reload }.not_to raise_error }
it { expect(DossierMailer).not_to have_received(:notify_automatic_deletion_to_user) }
@ -241,7 +241,7 @@ describe ExpiredDossiersDeletionService do
end
context 'when a notice has been sent a long time ago' do
let(:notice_sent_at) { (warning_period + 1.day).ago }
let(:notice_sent_at) { (warning_period + 4.days).ago }
it { expect { dossier.reload }.to raise_error(ActiveRecord::RecordNotFound) }