diff --git a/app/models/types_de_champ/prefill_departement_type_de_champ.rb b/app/models/types_de_champ/prefill_departement_type_de_champ.rb index 9a6fa807a..2ec1d1d11 100644 --- a/app/models/types_de_champ/prefill_departement_type_de_champ.rb +++ b/app/models/types_de_champ/prefill_departement_type_de_champ.rb @@ -3,10 +3,6 @@ class TypesDeChamp::PrefillDepartementTypeDeChamp < TypesDeChamp::PrefillTypeDeC departements.map { |departement| "#{departement[:code]} (#{departement[:name]})" } end - def example_value - departements.pick(:code) - end - private def departements diff --git a/app/models/types_de_champ/prefill_pays_type_de_champ.rb b/app/models/types_de_champ/prefill_pays_type_de_champ.rb index 143f041e7..6e5f9952c 100644 --- a/app/models/types_de_champ/prefill_pays_type_de_champ.rb +++ b/app/models/types_de_champ/prefill_pays_type_de_champ.rb @@ -3,10 +3,6 @@ class TypesDeChamp::PrefillPaysTypeDeChamp < TypesDeChamp::PrefillTypeDeChamp countries.map { |country| "#{country[:code]} (#{country[:name]})" } end - def example_value - countries.pick(:code) - end - private def countries diff --git a/config/locales/en.yml b/config/locales/en.yml index 4994f9127..c9f4af19e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -146,6 +146,7 @@ en: iban: FR7611315000011234567890138 yes_no: "true" pays: "FR" + departements: "56" regions: "53" date: "2023-02-01" datetime: "2023-02-01T10:30" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index b8402dfb2..b530475fc 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -138,6 +138,7 @@ fr: yes_no: "true" civilite: "M." pays: "FR" + departements: "56" regions: "53" date: "2023-02-01" datetime: "2023-02-01T10:30" diff --git a/spec/models/types_de_champ/prefill_departement_type_de_champ_spec.rb b/spec/models/types_de_champ/prefill_departement_type_de_champ_spec.rb index bba1b47a7..f43a07393 100644 --- a/spec/models/types_de_champ/prefill_departement_type_de_champ_spec.rb +++ b/spec/models/types_de_champ/prefill_departement_type_de_champ_spec.rb @@ -9,6 +9,12 @@ RSpec.describe TypesDeChamp::PrefillDepartementTypeDeChamp, type: :model do Rails.cache.clear end + describe 'ancestors' do + subject { described_class.build(type_de_champ) } + + it { is_expected.to be_kind_of(TypesDeChamp::PrefillTypeDeChamp) } + end + describe '#possible_values', vcr: { cassette_name: 'api_geo_departements' } do let(:expected_values) { APIGeoService.departements.sort_by { |departement| departement[:code] }.map { |departement| "#{departement[:code]} (#{departement[:name]})" } @@ -17,10 +23,4 @@ RSpec.describe TypesDeChamp::PrefillDepartementTypeDeChamp, type: :model do it { expect(possible_values).to match(expected_values) } end - - describe '#example_value', vcr: { cassette_name: 'api_geo_departements' } do - subject(:example_value) { described_class.new(type_de_champ).example_value } - - it { expect(example_value).to eq(APIGeoService.departements.sort_by { |departement| departement[:code] }.first[:code]) } - end end diff --git a/spec/models/types_de_champ/prefill_pays_type_de_champ_spec.rb b/spec/models/types_de_champ/prefill_pays_type_de_champ_spec.rb index f651d3d60..67789ba9e 100644 --- a/spec/models/types_de_champ/prefill_pays_type_de_champ_spec.rb +++ b/spec/models/types_de_champ/prefill_pays_type_de_champ_spec.rb @@ -2,16 +2,16 @@ RSpec.describe TypesDeChamp::PrefillPaysTypeDeChamp, type: :model do let(:type_de_champ) { build(:type_de_champ_pays) } + describe 'ancestors' do + subject { described_class.build(type_de_champ) } + + it { is_expected.to be_kind_of(TypesDeChamp::PrefillTypeDeChamp) } + end + describe '#possible_values' do let(:expected_values) { APIGeoService.countries.sort_by { |country| country[:code] }.map { |country| "#{country[:code]} (#{country[:name]})" } } subject(:possible_values) { described_class.new(type_de_champ).possible_values } it { expect(possible_values).to match(expected_values) } end - - describe '#example_value' do - subject(:example_value) { described_class.new(type_de_champ).example_value } - - it { expect(example_value).to eq(APIGeoService.countries.sort_by { |country| country[:code] }.first[:code]) } - end end