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:
parent
eea2912ae5
commit
3a8a50a216
19 changed files with 203 additions and 34 deletions
92
app/jobs/migrations/batch_update_pays_values_job.rb
Normal file
92
app/jobs/migrations/batch_update_pays_values_job.rb
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
class Migrations::BatchUpdatePaysValuesJob < ApplicationJob
|
||||||
|
UNUSUAL_COUNTRY_NAME_MATCHER = {
|
||||||
|
"ACORES, MADERE" => "Portugal",
|
||||||
|
"ALASKA" => "États-Unis",
|
||||||
|
"ANTILLES NEERLANDAISES" => "Pays-Bas",
|
||||||
|
"BIELORUSSIE" => "Bélarus",
|
||||||
|
"BONAIRE, SAINT EUSTACHE ET SABA" => "Bonaire, Saint-Eustache et Saba",
|
||||||
|
"BURKINA" => "Burkina Faso",
|
||||||
|
"CAIMANES (ILES)" => "îles Caïmans",
|
||||||
|
"CAMEROUN ET TOGO" => "Cameroun",
|
||||||
|
"CANARIES (ILES)" => "Espagne",
|
||||||
|
"CENTRAFRICAINE (REPUBLIQUE)" => "République centrafricaine",
|
||||||
|
"CHRISTMAS (ILE)" => "Christmas, Île",
|
||||||
|
"CONGO (REPUBLIQUE DEMOCRATIQUE)" => "République démocratique du Congo",
|
||||||
|
"COOK (ILES)" => "îles Cook",
|
||||||
|
"COREE (REPUBLIQUE DE)" => "Corée, République de",
|
||||||
|
"COREE (REPUBLIQUE POPULAIRE DEMOCRATIQUE DE)" => "Corée, République populaire démocratique de",
|
||||||
|
"COREE" => "Corée, République de",
|
||||||
|
"DOMINICAINE (REPUBLIQUE)" => "République dominicaine",
|
||||||
|
"ETATS MALAIS NON FEDERES" => "Malaisie",
|
||||||
|
"FEROE (ILES)" => "îles Féroé",
|
||||||
|
"GUYANE" => "France",
|
||||||
|
"HAWAII (ILES)" => "États-Unis",
|
||||||
|
"HEARD ET MACDONALD (ILES)" => "îles Heard-et-MacDonald",
|
||||||
|
"ILES PORTUGAISES DE L'OCEAN INDIEN" => "Portugal",
|
||||||
|
"IRLANDE, ou EIRE" => "Irlande",
|
||||||
|
"KAMTCHATKA" => "Russie, Fédération de",
|
||||||
|
"LA REUNION" => "Réunion, Île de la",
|
||||||
|
"LABRADOR" => "Canada",
|
||||||
|
"MACEDOINE DU NORD (REPUBLIQUE DE)" => "Macédoine du Nord",
|
||||||
|
"MALOUINES, OU FALKLAND (ILES)" => "Malouines, Îles (Falkland)",
|
||||||
|
"MAN (ILE)" => "Île de Man",
|
||||||
|
"MARIANNES DU NORD (ILES)" => "Îles Mariannes du Nord",
|
||||||
|
"MARSHALL (ILES)" => "Îles Marshall",
|
||||||
|
"OCEAN INDIEN (TERRITOIRE BRITANNIQUE DE L')" => "Royaume-Uni",
|
||||||
|
"PALESTINE (Etat de)" => "Palestine, État de",
|
||||||
|
"POSSESSIONS BRITANNIQUES AU PROCHE-ORIENT" => "Royaume-Uni",
|
||||||
|
"PROVINCES ESPAGNOLES D'AFRIQUE" => "Espagne",
|
||||||
|
"REPUBLIQUE DEMOCRATIQUE ALLEMANDE" => "Allemagne",
|
||||||
|
"REPUBLIQUE FEDERALE D'ALLEMAGNE" => "Allemagne",
|
||||||
|
"RUSSIE" => "Russie, Fédération de",
|
||||||
|
"SAINT-MARTIN" => "Saint-Martin (partie française)",
|
||||||
|
"SAINT-VINCENT-ET-LES GRENADINES" => "Saint-Vincent-et-les-Grenadines",
|
||||||
|
"SAINTE HELENE, ASCENSION ET TRISTAN DA CUNHA" => "Sainte-Hélène, Ascension et Tristan da Cunha",
|
||||||
|
"SALOMON (ILES)" => "Salomon, Îles",
|
||||||
|
"SAMOA OCCIDENTALES" => "Samoa",
|
||||||
|
"SIBERIE" => "Russie, Fédération de",
|
||||||
|
"SOUDAN ANGLO-EGYPTIEN, KENYA, OUGANDA" => "Ouganda",
|
||||||
|
"SYRIE" => "Syrienne, République arabe",
|
||||||
|
"TANGER" => "Maroc",
|
||||||
|
"TCHECOSLOVAQUIE" => "Tchéquie",
|
||||||
|
"TCHEQUE (REPUBLIQUE)" => "Tchéquie",
|
||||||
|
"TERR. DES ETATS-UNIS D'AMERIQUE EN AMERIQUE" => "États-Unis",
|
||||||
|
"TERR. DES ETATS-UNIS D'AMERIQUE EN OCEANIE" => "États-Unis",
|
||||||
|
"TERR. DU ROYAUME-UNI DANS L'ATLANTIQUE SUD" => "Royaume-Uni",
|
||||||
|
"TERRE-NEUVE" => "Canada",
|
||||||
|
"TERRITOIRES DU ROYAUME-UNI AUX ANTILLES" => "Royaume-Uni",
|
||||||
|
"TURKESTAN RUSSE" => "Russie, Fédération de",
|
||||||
|
"TURKS ET CAIQUES (ILES)" => "îles Turques-et-Caïques",
|
||||||
|
"TURQUIE D'EUROPE" => "Turquie",
|
||||||
|
"VATICAN, ou SAINT-SIEGE" => "Saint-Siège (état de la cité du Vatican)",
|
||||||
|
"VIERGES BRITANNIQUES (ILES)" => "Îles Vierges britanniques",
|
||||||
|
"VIERGES DES ETATS-UNIS (ILES)" => "Îles Vierges des États-Unis",
|
||||||
|
"VIET NAM DU NORD" => "Viêt Nam",
|
||||||
|
"VIET NAM DU SUD" => "Viêt Nam",
|
||||||
|
"WALLIS-ET-FUTUNA" => "Wallis et Futuna",
|
||||||
|
"YEMEN (REPUBLIQUE ARABE DU)" => "Yémen",
|
||||||
|
"YEMEN DEMOCRATIQUE" => "Yémen",
|
||||||
|
"ZANZIBAR" => "Tanzanie"
|
||||||
|
}
|
||||||
|
|
||||||
|
private_constant :UNUSUAL_COUNTRY_NAME_MATCHER
|
||||||
|
|
||||||
|
def perform(ids)
|
||||||
|
ids.each do |id|
|
||||||
|
pays_champ = Champs::PaysChamp.find(id)
|
||||||
|
next if pays_champ.valid?
|
||||||
|
|
||||||
|
code = APIGeoService.country_code(pays_champ.value)
|
||||||
|
value = if code.present?
|
||||||
|
APIGeoService.country_name(code)
|
||||||
|
else
|
||||||
|
UNUSUAL_COUNTRY_NAME_MATCHER[pays_champ.value]
|
||||||
|
end
|
||||||
|
|
||||||
|
if value.present? || !pays_champ.required?
|
||||||
|
associated_country_code = APIGeoService.country_code(value)
|
||||||
|
pays_champ.update_columns(value: value, external_id: associated_country_code)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -21,6 +21,9 @@
|
||||||
# type_de_champ_id :integer
|
# type_de_champ_id :integer
|
||||||
#
|
#
|
||||||
class Champs::PaysChamp < Champs::TextChamp
|
class Champs::PaysChamp < Champs::TextChamp
|
||||||
|
validates :value, inclusion: APIGeoService.countries.pluck(:name), allow_nil: true, allow_blank: false
|
||||||
|
validates :external_id, inclusion: APIGeoService.countries.pluck(:code), allow_nil: true, allow_blank: false
|
||||||
|
|
||||||
def for_export
|
def for_export
|
||||||
[name, code]
|
[name, code]
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,8 @@ class PrefillParams
|
||||||
TypeDeChamp.type_champs.fetch(:datetime),
|
TypeDeChamp.type_champs.fetch(:datetime),
|
||||||
TypeDeChamp.type_champs.fetch(:civilite),
|
TypeDeChamp.type_champs.fetch(:civilite),
|
||||||
TypeDeChamp.type_champs.fetch(:yes_no),
|
TypeDeChamp.type_champs.fetch(:yes_no),
|
||||||
TypeDeChamp.type_champs.fetch(:checkbox)
|
TypeDeChamp.type_champs.fetch(:checkbox),
|
||||||
|
TypeDeChamp.type_champs.fetch(:pays)
|
||||||
]
|
]
|
||||||
|
|
||||||
attr_reader :champ, :value
|
attr_reader :champ, :value
|
||||||
|
|
|
@ -261,6 +261,7 @@ class TypeDeChamp < ApplicationRecord
|
||||||
TypeDeChamp.type_champs.fetch(:phone),
|
TypeDeChamp.type_champs.fetch(:phone),
|
||||||
TypeDeChamp.type_champs.fetch(:iban),
|
TypeDeChamp.type_champs.fetch(:iban),
|
||||||
TypeDeChamp.type_champs.fetch(:civilite),
|
TypeDeChamp.type_champs.fetch(:civilite),
|
||||||
|
TypeDeChamp.type_champs.fetch(:pays),
|
||||||
TypeDeChamp.type_champs.fetch(:date),
|
TypeDeChamp.type_champs.fetch(:date),
|
||||||
TypeDeChamp.type_champs.fetch(:datetime),
|
TypeDeChamp.type_champs.fetch(:datetime),
|
||||||
TypeDeChamp.type_champs.fetch(:yes_no),
|
TypeDeChamp.type_champs.fetch(:yes_no),
|
||||||
|
|
|
@ -3,7 +3,7 @@ class TypesDeChamp::PrefillDropDownListTypeDeChamp < TypesDeChamp::PrefillTypeDe
|
||||||
if drop_down_other?
|
if drop_down_other?
|
||||||
drop_down_list_enabled_non_empty_options.insert(
|
drop_down_list_enabled_non_empty_options.insert(
|
||||||
0,
|
0,
|
||||||
I18n.t("views.prefill_descriptions.edit.possible_values.drop_down_list_other")
|
I18n.t("views.prefill_descriptions.edit.possible_values.drop_down_list_other_html")
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
drop_down_list_enabled_non_empty_options
|
drop_down_list_enabled_non_empty_options
|
||||||
|
|
|
@ -17,7 +17,7 @@ class TypesDeChamp::PrefillTypeDeChamp < SimpleDelegator
|
||||||
def possible_values
|
def possible_values
|
||||||
return [] unless prefillable?
|
return [] unless prefillable?
|
||||||
|
|
||||||
[I18n.t("views.prefill_descriptions.edit.possible_values.#{type_champ}")]
|
[I18n.t("views.prefill_descriptions.edit.possible_values.#{type_champ}_html")]
|
||||||
end
|
end
|
||||||
|
|
||||||
def example_value
|
def example_value
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
%button.fr-btn.fr-btn--secondary{ disabled: true }
|
%button.fr-btn.fr-btn--secondary{ disabled: true }
|
||||||
= t("views.prefill_descriptions.edit.champ_unavailable")
|
= t("views.prefill_descriptions.edit.champ_unavailable")
|
||||||
|
|
||||||
|
%p
|
||||||
= type_de_champ.description
|
= type_de_champ.description
|
||||||
|
|
||||||
%table.table.vertical
|
%table.table.vertical
|
||||||
|
|
|
@ -108,6 +108,7 @@ ignore_unused:
|
||||||
- 'views.pagination.*'
|
- 'views.pagination.*'
|
||||||
- 'time.formats.default'
|
- 'time.formats.default'
|
||||||
- 'instructeurs.dossiers.filterable_state.*'
|
- 'instructeurs.dossiers.filterable_state.*'
|
||||||
|
- 'views.prefill_descriptions.edit.possible_values.*'
|
||||||
# - '{devise,kaminari,will_paginate}.*'
|
# - '{devise,kaminari,will_paginate}.*'
|
||||||
# - 'simple_form.{yes,no}'
|
# - 'simple_form.{yes,no}'
|
||||||
# - 'simple_form.{placeholders,hints,labels}.*'
|
# - 'simple_form.{placeholders,hints,labels}.*'
|
||||||
|
|
|
@ -113,18 +113,20 @@ en:
|
||||||
champ_unavailable: Unavailable
|
champ_unavailable: Unavailable
|
||||||
possible_values:
|
possible_values:
|
||||||
title: Values
|
title: Values
|
||||||
text: A short text
|
text_html: A short text
|
||||||
textarea: A long text
|
textarea_html: A long text
|
||||||
decimal_number: A decimal number
|
decimal_number_html: A decimal number
|
||||||
integer_number: An integer number
|
integer_number_html: An integer number
|
||||||
email: An email address
|
email_html: An email address
|
||||||
phone: A phone number
|
civilite_html: '"M." for Mister, "Mme" for Madam'
|
||||||
iban: An Iban number
|
phone_html: A phone number
|
||||||
yes_no: '"true" for Yes, "false" pour No'
|
iban_html: An Iban number
|
||||||
date: ISO8601 date
|
yes_no_html: '"true" for Yes, "false" pour No'
|
||||||
datetime: ISO8601 datetime
|
checkbox_html: '"true" to check, "false" to uncheck'
|
||||||
checkbox: '"true" to check, "false" to uncheck'
|
pays_html: An <a href="https://en.wikipedia.org/wiki/ISO_3166-2" target="_blank">ISO 3166-2 country code</a>
|
||||||
drop_down_list_other: Any value
|
date_html: ISO8601 date
|
||||||
|
datetime_html: ISO8601 datetime
|
||||||
|
drop_down_list_other_html: Any value
|
||||||
examples:
|
examples:
|
||||||
title: Example
|
title: Example
|
||||||
text: Short text
|
text: Short text
|
||||||
|
@ -135,6 +137,7 @@ en:
|
||||||
phone: 0612345678
|
phone: 0612345678
|
||||||
iban: FR7611315000011234567890138
|
iban: FR7611315000011234567890138
|
||||||
yes_no: "true"
|
yes_no: "true"
|
||||||
|
pays: "FR"
|
||||||
date: "2023-02-01"
|
date: "2023-02-01"
|
||||||
datetime: "2023-02-01T10:30"
|
datetime: "2023-02-01T10:30"
|
||||||
checkbox: "true"
|
checkbox: "true"
|
||||||
|
|
|
@ -104,19 +104,20 @@ fr:
|
||||||
champ_unavailable: Indisponible
|
champ_unavailable: Indisponible
|
||||||
possible_values:
|
possible_values:
|
||||||
title: Valeurs
|
title: Valeurs
|
||||||
text: Un texte court
|
text_html: Un texte court
|
||||||
textarea: Un texte long
|
textarea_html: Un texte long
|
||||||
decimal_number: Un nombre décimal
|
decimal_number_html: Un nombre décimal
|
||||||
integer_number: Un nombre entier
|
integer_number_html: Un nombre entier
|
||||||
email: Une adresse email
|
email_html: Une adresse email
|
||||||
civilite: '"M." pour Monsieur, "Mme" pour Madame'
|
civilite_html: '"M." pour Monsieur, "Mme" pour Madame'
|
||||||
phone: Un numéro de téléphone
|
phone_html: Un numéro de téléphone
|
||||||
iban: Un numéro Iban
|
iban_html: Un numéro Iban
|
||||||
yes_no: '"true" pour Oui, "false" pour Non'
|
yes_no_html: '"true" pour Oui, "false" pour Non'
|
||||||
date: Date au format ISO8601
|
checkbox_html: '"true" pour coché, "false" pour décoché'
|
||||||
datetime: Datetime au format ISO8601
|
pays_html: Un <a href="https://en.wikipedia.org/wiki/ISO_3166-2" target="_blank">code pays ISO 3166-2</a>
|
||||||
checkbox: '"true" pour coché, "false" pour décoché'
|
datetime_html: Datetime au format ISO8601
|
||||||
drop_down_list_other: Toute valeur
|
date_html: Date au format ISO8601
|
||||||
|
drop_down_list_other_html: Toute valeur
|
||||||
examples:
|
examples:
|
||||||
title: Exemple
|
title: Exemple
|
||||||
text: Texte court
|
text: Texte court
|
||||||
|
@ -128,6 +129,7 @@ fr:
|
||||||
iban: FR7611315000011234567890138
|
iban: FR7611315000011234567890138
|
||||||
yes_no: "true"
|
yes_no: "true"
|
||||||
civilite: "M."
|
civilite: "M."
|
||||||
|
pays: "FR"
|
||||||
date: "2023-02-01"
|
date: "2023-02-01"
|
||||||
datetime: "2023-02-01T10:30"
|
datetime: "2023-02-01T10:30"
|
||||||
checkbox: "true"
|
checkbox: "true"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
fr:
|
en:
|
||||||
activerecord:
|
activerecord:
|
||||||
models:
|
models:
|
||||||
type_de_champ: 'Field type'
|
type_de_champ: 'Field type'
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: normalize_pays_values'
|
||||||
|
task normalize_pays_values: :environment do
|
||||||
|
puts "Running deploy task 'normalize_pays_values'"
|
||||||
|
|
||||||
|
# Put your task implementation HERE.
|
||||||
|
Champs::PaysChamp.in_batches do |pays_champs|
|
||||||
|
Migrations::BatchUpdatePaysValuesJob.perform_later(pays_champs.pluck(:id))
|
||||||
|
end
|
||||||
|
|
||||||
|
# Update task as completed. If you remove the line below, the task will
|
||||||
|
# run with every deploy (or every time you call after_party:run).
|
||||||
|
AfterParty::TaskRecord
|
||||||
|
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
||||||
|
end
|
||||||
|
end
|
47
spec/jobs/migrations/batch_update_pays_values_job_spec.rb
Normal file
47
spec/jobs/migrations/batch_update_pays_values_job_spec.rb
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
describe Migrations::BatchUpdatePaysValuesJob, type: :job do
|
||||||
|
before do
|
||||||
|
pays_champ.save(validate: false)
|
||||||
|
end
|
||||||
|
|
||||||
|
subject { described_class.perform_now([pays_champ.id]) }
|
||||||
|
|
||||||
|
context "the value is correct" do
|
||||||
|
let(:pays_champ) { build(:champ_pays, value: 'France', external_id: 'FR') }
|
||||||
|
|
||||||
|
it 'does not change it' do
|
||||||
|
subject
|
||||||
|
expect(pays_champ.reload.value).to eq('France')
|
||||||
|
expect(pays_champ.reload.external_id).to eq('FR')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "the value is incorrect" do
|
||||||
|
let(:pays_champ) { build(:champ_pays, value: 'Incorrect') }
|
||||||
|
|
||||||
|
it 'updates value to nil' do
|
||||||
|
subject
|
||||||
|
expect(pays_champ.reload.value).to be_nil
|
||||||
|
expect(pays_champ.reload.external_id).to be_nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "the value is easily cleanable" do
|
||||||
|
let(:pays_champ) { build(:champ_pays, value: 'Vietnam') }
|
||||||
|
|
||||||
|
it 'cleans the value' do
|
||||||
|
subject
|
||||||
|
expect(pays_champ.reload.value).to eq('Viêt Nam')
|
||||||
|
expect(pays_champ.reload.external_id).to eq('VN')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "the value is hard to clean" do
|
||||||
|
let(:pays_champ) { build(:champ_pays, value: 'CHRISTMAS (ILE)') }
|
||||||
|
|
||||||
|
it 'cleans the value' do
|
||||||
|
subject
|
||||||
|
expect(pays_champ.reload.value).to eq('Christmas, Île')
|
||||||
|
expect(pays_champ.reload.external_id).to eq('CX')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -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", :phone, "value"
|
||||||
it_behaves_like "a champ public value that is authorized", :iban, "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", :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", :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", :datetime, "2022-12-22T10:30"
|
||||||
it_behaves_like "a champ public value that is authorized", :yes_no, "true"
|
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", :phone, "value"
|
||||||
it_behaves_like "a champ private value that is authorized", :iban, "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", :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", :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", :datetime, "2022-12-22T10:30"
|
||||||
it_behaves_like "a champ private value that is authorized", :yes_no, "true"
|
it_behaves_like "a champ private value that is authorized", :yes_no, "true"
|
||||||
|
|
|
@ -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_date
|
||||||
it_behaves_like "a prefillable type de champ", :type_de_champ_datetime
|
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_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_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_checkbox
|
||||||
it_behaves_like "a prefillable type de champ", :type_de_champ_drop_down_list
|
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_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_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_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_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_departements
|
||||||
it_behaves_like "a non-prefillable type de champ", :type_de_champ_siret
|
it_behaves_like "a non-prefillable type de champ", :type_de_champ_siret
|
||||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe TypesDeChamp::PrefillDropDownListTypeDeChamp do
|
||||||
|
|
||||||
it {
|
it {
|
||||||
expect(possible_values).to match(
|
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
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe TypesDeChamp::PrefillTypeDeChamp, type: :model do
|
||||||
context 'when the type de champ is prefillable' do
|
context 'when the type de champ is prefillable' do
|
||||||
let(:type_de_champ) { build(:type_de_champ_email) }
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,7 @@ describe DossierProjectionService do
|
||||||
dossier.champs_public.first.update(value: "qu'il est beau mon pays")
|
dossier.champs_public.first.update(value: "qu'il est beau mon pays")
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to eq("qu'il est beau mon pays") }
|
it { is_expected.to eq("") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue