export code insee for commune champ
This commit is contained in:
parent
daa306859c
commit
4a6c22d6a6
2 changed files with 13 additions and 0 deletions
|
@ -18,4 +18,7 @@
|
|||
# type_de_champ_id :integer
|
||||
#
|
||||
class Champs::CommuneChamp < Champs::TextChamp
|
||||
def for_export
|
||||
[value, external_id]
|
||||
end
|
||||
end
|
||||
|
|
10
spec/models/champs/commune_champ_spec.rb
Normal file
10
spec/models/champs/commune_champ_spec.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
describe Champs::CommuneChamp do
|
||||
let(:type_de_champ) { create(:type_de_champ_communes, libelle: 'Ma commune') }
|
||||
let(:champ) { Champs::CommuneChamp.new(value: value, external_id: code_insee, type_de_champ: type_de_champ) }
|
||||
let(:value) { 'Châteldon (63290)' }
|
||||
let(:code_insee) { '63102' }
|
||||
|
||||
it { expect(champ.value).to eq('Châteldon (63290)') }
|
||||
it { expect(champ.external_id).to eq('63102') }
|
||||
it { expect(champ.for_export).to eq(['Châteldon (63290)', '63102']) }
|
||||
end
|
Loading…
Reference in a new issue