From 2e873254feb62c8ca79463a6df84e361be1d4339 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 20 Nov 2024 16:38:08 +0100 Subject: [PATCH] refactor(columns): normalize (upcase first) address columns wording --- app/models/concerns/addressable_column_concern.rb | 8 ++++---- spec/models/concerns/columns_concern_spec.rb | 4 ++-- spec/services/dossier_filter_service_spec.rb | 6 +++--- spec/services/dossier_projection_service_spec.rb | 4 ++-- spec/system/instructeurs/procedure_filters_spec.rb | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/models/concerns/addressable_column_concern.rb b/app/models/concerns/addressable_column_concern.rb index b3a6edf73..d96300a67 100644 --- a/app/models/concerns/addressable_column_concern.rb +++ b/app/models/concerns/addressable_column_concern.rb @@ -6,10 +6,10 @@ module AddressableColumnConcern included do def addressable_columns(procedure:, displayable: true, prefix: nil) [ - ["code postal (5 chiffres)", '$.postal_code', :text, []], - ["commune", '$.city_name', :text, []], - ["département", '$.departement_code', :enum, APIGeoService.departement_options], - ["region", '$.region_name', :enum, APIGeoService.region_options] + ["Code postal (5 chiffres)", '$.postal_code', :text, []], + ["Commune", '$.city_name', :text, []], + ["Département", '$.departement_code', :enum, APIGeoService.departement_options], + ["Région", '$.region_name', :enum, APIGeoService.region_options] ].map do |(label, jsonpath, type, options_for_select)| Columns::JSONPathColumn.new( procedure_id: procedure.id, diff --git a/spec/models/concerns/columns_concern_spec.rb b/spec/models/concerns/columns_concern_spec.rb index 3cc07308b..4b21061fa 100644 --- a/spec/models/concerns/columns_concern_spec.rb +++ b/spec/models/concerns/columns_concern_spec.rb @@ -99,9 +99,9 @@ describe ColumnsConcern do end context 'with rna' do - let(:types_de_champ_public) { [{ type: :rna, libelle: 'rna' }] } + let(:types_de_champ_public) { [{ type: :rna, libelle: 'RNA' }] } let(:types_de_champ_private) { [] } - it { expect(subject.map(&:label)).to include('rna – commune') } + it { expect(subject.map(&:label)).to include('RNA – Commune') } end context 'with linked drop down list' do diff --git a/spec/services/dossier_filter_service_spec.rb b/spec/services/dossier_filter_service_spec.rb index 7a85e02ac..28d16a283 100644 --- a/spec/services/dossier_filter_service_spec.rb +++ b/spec/services/dossier_filter_service_spec.rb @@ -572,7 +572,7 @@ describe DossierFilterService do context "when searching by postal_code (text)" do let(:value) { "60580" } - let(:filter) { ["rna – code postal (5 chiffres)", value] } + let(:filter) { ["rna – Code postal (5 chiffres)", value] } before do kept_dossier.project_champs_public.find { _1.stable_id == 1 }.update(value_json: { "postal_code" => value }) @@ -589,7 +589,7 @@ describe DossierFilterService do context "when searching by departement_code (enum)" do let(:value) { "99" } - let(:filter) { ["rna – département", value] } + let(:filter) { ["rna – Département", value] } before do kept_dossier.project_champs_public.find { _1.stable_id == 1 }.update(value_json: { "departement_code" => value }) @@ -606,7 +606,7 @@ describe DossierFilterService do context "when searching by region_name" do let(:value) { "60" } - let(:filter) { ["rna – region", value] } + let(:filter) { ["rna – Région", value] } before do kept_dossier.project_champs_public.find { _1.stable_id == 1 }.update(value_json: { "region_name" => value }) diff --git a/spec/services/dossier_projection_service_spec.rb b/spec/services/dossier_projection_service_spec.rb index e55a72734..9029846d0 100644 --- a/spec/services/dossier_projection_service_spec.rb +++ b/spec/services/dossier_projection_service_spec.rb @@ -239,9 +239,9 @@ describe DossierProjectionService do end context 'for a json column' do - let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :siret, libelle: 'siret' }]) } + let(:procedure) { create(:procedure, types_de_champ_public: [{ type: :siret, libelle: 'SIRET' }]) } let(:dossier) { create(:dossier, procedure:) } - let(:label) { "siret – département" } + let(:label) { "SIRET – Département" } before do dossier.project_champs_public.first.update(value_json: { 'departement_code': '38' }) diff --git a/spec/system/instructeurs/procedure_filters_spec.rb b/spec/system/instructeurs/procedure_filters_spec.rb index 2e3f54a0e..dac3aeaac 100644 --- a/spec/system/instructeurs/procedure_filters_spec.rb +++ b/spec/system/instructeurs/procedure_filters_spec.rb @@ -154,7 +154,7 @@ describe "procedure filters" do rna_champ.reload champ_select_value = "37 – Indre-et-Loire" - add_filter("#{rna_champ.libelle} – département", champ_select_value, type: :enum) + add_filter("#{rna_champ.libelle} – Département", champ_select_value, type: :enum) expect(page).to have_link(new_unfollow_dossier.id.to_s) end end