Allow prefill pays type de champs (#8344)

* Allow prefill pays type de champs

* Avoid conditional prefil params for pays champ

* Clean pays data with batch update

* Fix bug and add test batch update pays value

* Improve performance batch_update_pays

* Fix associated country code problem

* Fix after party task name

* Format country name if needed in batch update
This commit is contained in:
Damien Le Thiec 2023-01-18 12:52:38 +01:00 committed by GitHub
parent eea2912ae5
commit 3a8a50a216
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 203 additions and 34 deletions

View file

@ -110,6 +110,7 @@ RSpec.describe PrefillParams do
it_behaves_like "a champ public value that is authorized", :phone, "value"
it_behaves_like "a champ public value that is authorized", :iban, "value"
it_behaves_like "a champ public value that is authorized", :civilite, "M."
it_behaves_like "a champ public value that is authorized", :pays, "FR"
it_behaves_like "a champ public value that is authorized", :date, "2022-12-22"
it_behaves_like "a champ public value that is authorized", :datetime, "2022-12-22T10:30"
it_behaves_like "a champ public value that is authorized", :yes_no, "true"
@ -126,6 +127,7 @@ RSpec.describe PrefillParams do
it_behaves_like "a champ private value that is authorized", :phone, "value"
it_behaves_like "a champ private value that is authorized", :iban, "value"
it_behaves_like "a champ private value that is authorized", :civilite, "M."
it_behaves_like "a champ private value that is authorized", :pays, "FR"
it_behaves_like "a champ private value that is authorized", :date, "2022-12-22"
it_behaves_like "a champ private value that is authorized", :datetime, "2022-12-22T10:30"
it_behaves_like "a champ private value that is authorized", :yes_no, "true"

View file

@ -245,6 +245,7 @@ describe TypeDeChamp do
it_behaves_like "a prefillable type de champ", :type_de_champ_date
it_behaves_like "a prefillable type de champ", :type_de_champ_datetime
it_behaves_like "a prefillable type de champ", :type_de_champ_civilite
it_behaves_like "a prefillable type de champ", :type_de_champ_pays
it_behaves_like "a prefillable type de champ", :type_de_champ_yes_no
it_behaves_like "a prefillable type de champ", :type_de_champ_checkbox
it_behaves_like "a prefillable type de champ", :type_de_champ_drop_down_list
@ -265,7 +266,6 @@ describe TypeDeChamp do
it_behaves_like "a non-prefillable type de champ", :type_de_champ_mesri
it_behaves_like "a non-prefillable type de champ", :type_de_champ_carte
it_behaves_like "a non-prefillable type de champ", :type_de_champ_address
it_behaves_like "a non-prefillable type de champ", :type_de_champ_pays
it_behaves_like "a non-prefillable type de champ", :type_de_champ_regions
it_behaves_like "a non-prefillable type de champ", :type_de_champ_departements
it_behaves_like "a non-prefillable type de champ", :type_de_champ_siret

View file

@ -9,7 +9,7 @@ RSpec.describe TypesDeChamp::PrefillDropDownListTypeDeChamp do
it {
expect(possible_values).to match(
[I18n.t("views.prefill_descriptions.edit.possible_values.drop_down_list_other")] + type_de_champ.drop_down_list_enabled_non_empty_options
[I18n.t("views.prefill_descriptions.edit.possible_values.drop_down_list_other_html")] + type_de_champ.drop_down_list_enabled_non_empty_options
)
}
end

View file

@ -38,7 +38,7 @@ RSpec.describe TypesDeChamp::PrefillTypeDeChamp, type: :model do
context 'when the type de champ is prefillable' do
let(:type_de_champ) { build(:type_de_champ_email) }
it { expect(possible_values).to match([I18n.t("views.prefill_descriptions.edit.possible_values.#{type_de_champ.type_champ}")]) }
it { expect(possible_values).to match([I18n.t("views.prefill_descriptions.edit.possible_values.#{type_de_champ.type_champ}_html")]) }
end
end