Merge pull request #5114 from tchak/fix-dossiers-expiration-tests
Use a “safe” reference date in expiration tests
This commit is contained in:
commit
1d76cf9c32
1 changed files with 7 additions and 6 deletions
|
@ -4,6 +4,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:procedure) { create(:procedure, :published) }
|
let(:procedure) { create(:procedure, :published) }
|
||||||
let(:procedure_2) { create(:procedure, :published) }
|
let(:procedure_2) { create(:procedure, :published) }
|
||||||
|
let(:reference_date) { Date.parse("March 8") }
|
||||||
|
|
||||||
describe '#process_expired_dossiers_brouillon' do
|
describe '#process_expired_dossiers_brouillon' do
|
||||||
let(:today) { Time.zone.now.at_midnight }
|
let(:today) { Time.zone.now.at_midnight }
|
||||||
|
@ -43,7 +44,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#send_brouillon_expiration_notices' do
|
describe '#send_brouillon_expiration_notices' do
|
||||||
before { Timecop.freeze(Time.zone.now) }
|
before { Timecop.freeze(reference_date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -83,7 +84,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#delete_expired_brouillons_and_notify' do
|
describe '#delete_expired_brouillons_and_notify' do
|
||||||
before { Timecop.freeze(Time.zone.now) }
|
before { Timecop.freeze(reference_date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -131,7 +132,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#send_en_construction_expiration_notices' do
|
describe '#send_en_construction_expiration_notices' do
|
||||||
before { Timecop.freeze(Time.zone.now) }
|
before { Timecop.freeze(reference_date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -202,7 +203,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
describe '#delete_expired_en_construction_and_notify' do
|
describe '#delete_expired_en_construction_and_notify' do
|
||||||
let!(:warning_period) { 1.month + 5.days }
|
let!(:warning_period) { 1.month + 5.days }
|
||||||
|
|
||||||
before { Timecop.freeze(Time.zone.now) }
|
before { Timecop.freeze(reference_date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -270,7 +271,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#send_termine_expiration_notices' do
|
describe '#send_termine_expiration_notices' do
|
||||||
before { Timecop.freeze(Time.zone.now) }
|
before { Timecop.freeze(reference_date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
@ -339,7 +340,7 @@ describe ExpiredDossiersDeletionService do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#delete_expired_termine_and_notify' do
|
describe '#delete_expired_termine_and_notify' do
|
||||||
before { Timecop.freeze(Time.zone.now) }
|
before { Timecop.freeze(reference_date) }
|
||||||
after { Timecop.return }
|
after { Timecop.return }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
Loading…
Reference in a new issue