2021-08-18 14:08:38 +02:00
|
|
|
describe Champs::CommuneChamp do
|
|
|
|
let(:type_de_champ) { create(:type_de_champ_communes, libelle: 'Ma commune') }
|
2022-07-04 15:36:59 +02:00
|
|
|
let(:champ) { Champs::CommuneChamp.new(value: value, external_id: code_insee, departement: departement, code_departement: code_departement, type_de_champ: type_de_champ) }
|
2021-08-18 14:08:38 +02:00
|
|
|
let(:value) { 'Châteldon (63290)' }
|
|
|
|
let(:code_insee) { '63102' }
|
2022-07-04 15:36:59 +02:00
|
|
|
let(:departement) { '' }
|
|
|
|
let(:code_departement) { '' }
|
2021-08-18 14:08:38 +02:00
|
|
|
|
|
|
|
it { expect(champ.value).to eq('Châteldon (63290)') }
|
|
|
|
it { expect(champ.external_id).to eq('63102') }
|
2022-07-04 15:36:59 +02:00
|
|
|
it { expect(champ.for_export).to eq(['Châteldon (63290)', '63102', '']) }
|
|
|
|
|
|
|
|
context do
|
|
|
|
let(:departement) { 'Puy-de-Dôme' }
|
|
|
|
let(:code_departement) { '63' }
|
|
|
|
|
|
|
|
it { expect(champ.for_export).to eq(['Châteldon (63290)', '63102', '63 - Puy-de-Dôme']) }
|
|
|
|
end
|
2021-08-18 14:08:38 +02:00
|
|
|
end
|