From 592ba936f20ba5b7ee970f2fdb3607df93fe113e Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Thu, 13 Feb 2025 17:23:24 +0100 Subject: [PATCH] refactor: be month explicit --- config/locales/time_format.fr.rb | 6 ++++++ spec/components/instructeurs/cell_component_spec.rb | 4 ++-- .../instructeurs/filter_buttons_component_spec.rb | 4 ++-- .../instructeurs/sva_svr_decision_badge_component_spec.rb | 2 +- spec/helpers/dossier_helper_spec.rb | 2 +- spec/system/administrateurs/procedure_closing_spec.rb | 2 +- spec/system/api_particulier/api_particulier_spec.rb | 6 +++--- spec/views/instructeur/dossiers/show.html.haml_spec.rb | 2 +- 8 files changed, 17 insertions(+), 11 deletions(-) diff --git a/config/locales/time_format.fr.rb b/config/locales/time_format.fr.rb index 210c30121b8..457ca9c3507 100644 --- a/config/locales/time_format.fr.rb +++ b/config/locales/time_format.fr.rb @@ -17,6 +17,12 @@ } }, + date: { + formats: { + default: "%d %B %Y" + } + }, + datetime: { distance_in_words: { x_weeks: { diff --git a/spec/components/instructeurs/cell_component_spec.rb b/spec/components/instructeurs/cell_component_spec.rb index ed3b2b7b757..1907ba2aef6 100644 --- a/spec/components/instructeurs/cell_component_spec.rb +++ b/spec/components/instructeurs/cell_component_spec.rb @@ -80,7 +80,7 @@ before { dossier.champs.first.update(value: Date.parse("12/02/2025")) } - it { is_expected.to eq('12/02/2025') } + it { is_expected.to eq('12 février 2025') } end context 'for a datetime column' do @@ -102,7 +102,7 @@ etablissement.update_champ_value_json! } - it { is_expected.to eq('10/08/2015') } + it { is_expected.to eq('10 août 2015') } end context 'for a enum column' do diff --git a/spec/components/instructeurs/filter_buttons_component_spec.rb b/spec/components/instructeurs/filter_buttons_component_spec.rb index 5cffb18325d..8c937e0b8b1 100644 --- a/spec/components/instructeurs/filter_buttons_component_spec.rb +++ b/spec/components/instructeurs/filter_buttons_component_spec.rb @@ -43,7 +43,7 @@ def to_filter((label, filter)) = FilteredColumn.new(column: procedure.find_colum let(:filter) { to_filter(['Date de création', "15/06/2023"]) } it 'should get formatted value' do - expect(page).to have_text("15/06/2023") + expect(page).to have_text("15 juin 2023") end end @@ -57,7 +57,7 @@ def to_filter((label, filter)) = FilteredColumn.new(column: procedure.find_colum end it 'should display all filters' do - text = "État du dossier : En construction ou État du dossier : En instruction et Date de création : 15/06/2023" + text = "État du dossier : En construction ou État du dossier : En instruction et Date de création : 15 juin 2023" expect(page).to have_text(text) end end diff --git a/spec/components/instructeurs/sva_svr_decision_badge_component_spec.rb b/spec/components/instructeurs/sva_svr_decision_badge_component_spec.rb index 3eb3901f051..36e38feb547 100644 --- a/spec/components/instructeurs/sva_svr_decision_badge_component_spec.rb +++ b/spec/components/instructeurs/sva_svr_decision_badge_component_spec.rb @@ -18,7 +18,7 @@ context 'dossier en instruction' do let(:dossier) { create(:dossier, :en_instruction, procedure:, sva_svr_decision_on: Date.new(2023, 9, 5)) } it { expect(subject).to have_text("dans 4 jours") } - it { expect(title).to have_text("sera automatiquement traité le 05/09/2023") } + it { expect(title).to have_text("sera automatiquement traité le 05 septembre 2023") } context 'with label' do let(:with_label) { true } diff --git a/spec/helpers/dossier_helper_spec.rb b/spec/helpers/dossier_helper_spec.rb index 46b89df8469..71969c299b2 100644 --- a/spec/helpers/dossier_helper_spec.rb +++ b/spec/helpers/dossier_helper_spec.rb @@ -237,7 +237,7 @@ context "with complete france_connect information" do let(:user_information) { build(:france_connect_information, updated_at: Time.zone.now) } it { - expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}, authentifié par FranceConnect le #{user_information.updated_at.strftime('%d/%m/%Y')}") + expect(subject).to have_text("Le dossier a été déposé par le compte de #{user_information.given_name} #{user_information.family_name}, authentifié par FranceConnect le #{I18n.l(user_information.updated_at.to_date)}") } end diff --git a/spec/system/administrateurs/procedure_closing_spec.rb b/spec/system/administrateurs/procedure_closing_spec.rb index c65a3f61ac7..349f420e574 100644 --- a/spec/system/administrateurs/procedure_closing_spec.rb +++ b/spec/system/administrateurs/procedure_closing_spec.rb @@ -92,7 +92,7 @@ procedure.reload - expect(page).to have_text("Un email a été envoyé pour informer les usagers le #{procedure.closed_at.strftime('%d/%m/%Y')}") + expect(page).to have_text("Un email a été envoyé pour informer les usagers le #{I18n.l(procedure.closed_at.to_date)}") end end end diff --git a/spec/system/api_particulier/api_particulier_spec.rb b/spec/system/api_particulier/api_particulier_spec.rb index a2ad90dcf8c..6852cb09d9c 100644 --- a/spec/system/api_particulier/api_particulier_spec.rb +++ b/spec/system/api_particulier/api_particulier_spec.rb @@ -316,9 +316,9 @@ expect(page).to have_content('pays FRANCE') expect(page).to have_content('complément d’identité géographique au nord de paris') expect(page).to have_content('lieu-dit glagla') - expect(page).to have_content('ERIC SNOW masculin 07/01/1991') - expect(page).to have_content('SANSA SNOW féminin 15/01/1992') - expect(page).to have_content('PAUL SNOW masculin 04/01/2018') + expect(page).to have_content('ERIC SNOW masculin 07 janvier 1991') + expect(page).to have_content('SANSA SNOW féminin 15 janvier 1992') + expect(page).to have_content('PAUL SNOW masculin 04 janvier 2018') expect(page).to have_content('1856 6 2021') end end diff --git a/spec/views/instructeur/dossiers/show.html.haml_spec.rb b/spec/views/instructeur/dossiers/show.html.haml_spec.rb index 5920e20cec1..db83321c307 100644 --- a/spec/views/instructeur/dossiers/show.html.haml_spec.rb +++ b/spec/views/instructeur/dossiers/show.html.haml_spec.rb @@ -164,7 +164,7 @@ end it 'fills the individual with the informations from France Connect' do - expect(view.content_for(:notice_info)).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{france_connect_information.updated_at.strftime('%d/%m/%Y')}") + expect(view.content_for(:notice_info)).to have_text("Le dossier a été déposé par le compte de #{france_connect_information.given_name} #{france_connect_information.family_name}, authentifié par FranceConnect le #{I18n.l(france_connect_information.updated_at.to_date)}") end end