From d053a9bb8dbb474169c1fa11f6548a72ae8625bd Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Fri, 1 Mar 2019 18:25:15 +0100 Subject: [PATCH] Fix test for the 2 months following February The problem was caused by the variable lenght of 2.months.ago, used in the test. During the period from March 1st to April 29th, because February is so short, the message would change from 'delai de 2 mois' to 'delai de environ 2 mois', causing the test to fail. --- spec/features/new_user/dossier_details_spec.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/features/new_user/dossier_details_spec.rb b/spec/features/new_user/dossier_details_spec.rb index b24744713..a3cc373bb 100644 --- a/spec/features/new_user/dossier_details_spec.rb +++ b/spec/features/new_user/dossier_details_spec.rb @@ -30,10 +30,14 @@ describe 'Dossier details:' do let(:dossier) { create(:dossier, :en_instruction, :for_individual, :with_commentaires, user: user, procedure: procedure) } before do - other_dossier = create(:dossier, :accepte, :for_individual, procedure: procedure, en_instruction_at: 2.months.ago, processed_at: Time.zone.now) + Timecop.freeze(Time.zone.local(2012, 12, 20)) + + other_dossier = create(:dossier, :accepte, :for_individual, procedure: procedure, en_instruction_at: 60.days.ago, processed_at: Time.zone.now) visit dossier_path(dossier) end + after { Timecop.return } + it { expect(page).to have_text("Habituellement, les dossiers de cette démarche sont traités dans un délai de 2 mois.") } end end