review: put example values in translation yamls
This commit is contained in:
parent
a56efe22e5
commit
67ef3a16fa
6 changed files with 14 additions and 20 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue