fix(attestation): tag commune_name from address
This commit is contained in:
parent
c148f5a389
commit
ea89c2e8dd
2 changed files with 2 additions and 1 deletions
|
@ -61,7 +61,7 @@ class Champs::AddressChamp < Champs::TextChamp
|
||||||
|
|
||||||
def commune_name
|
def commune_name
|
||||||
if full_address?
|
if full_address?
|
||||||
"#{APIGeoService.commune_name(department_code, address['city_code'])} (#{address['postal_code']})"
|
"#{APIGeoService.commune_name(address.fetch('department_code'), address['city_code'])} (#{address['postal_code']})"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ describe Champs::AddressChamp do
|
||||||
it { expect(champ.address_label).to eq('33 Rue Rébeval 75019 Paris') }
|
it { expect(champ.address_label).to eq('33 Rue Rébeval 75019 Paris') }
|
||||||
it { expect(champ.full_address?).to be_truthy }
|
it { expect(champ.full_address?).to be_truthy }
|
||||||
it { expect(champ.commune).to eq({ name: 'Paris 19e Arrondissement', code: '75119', postal_code: '75019' }) }
|
it { expect(champ.commune).to eq({ name: 'Paris 19e Arrondissement', code: '75119', postal_code: '75019' }) }
|
||||||
|
it { expect(champ.commune_name).to eq('Paris 19e Arrondissement (75019)') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with wrong code INSEE" do
|
context "with wrong code INSEE" do
|
||||||
|
|
Loading…
Add table
Reference in a new issue