GeoArea on API expose fields per source type
This commit is contained in:
parent
5a8a4b393f
commit
fd490efb59
3 changed files with 61 additions and 21 deletions
|
@ -6,13 +6,29 @@ describe Champs::CarteChampSerializer do
|
|||
let(:geo_area) { create(:geo_area) }
|
||||
let(:champ) { create(:type_de_champ_carte).champ.create(geo_areas: [geo_area]) }
|
||||
|
||||
it {
|
||||
expect(subject[:geo_areas].first).to include(
|
||||
source: GeoArea.sources.fetch(:cadastre),
|
||||
numero: '42',
|
||||
feuille: 'A11'
|
||||
)
|
||||
}
|
||||
context 'and geo_area is cadastre' do
|
||||
it {
|
||||
expect(subject[:geo_areas].first).to include(
|
||||
source: GeoArea.sources.fetch(:cadastre),
|
||||
numero: '42',
|
||||
feuille: 'A11'
|
||||
)
|
||||
expect(subject[:geo_areas].first.key?(:nom)).to be_falsey
|
||||
}
|
||||
end
|
||||
|
||||
context 'and geo_area is quartier_prioritaire' do
|
||||
let(:geo_area) { create(:geo_area, :quartier_prioritaire) }
|
||||
|
||||
it {
|
||||
expect(subject[:geo_areas].first).to include(
|
||||
source: GeoArea.sources.fetch(:quartier_prioritaire),
|
||||
nom: 'XYZ',
|
||||
commune: 'Paris'
|
||||
)
|
||||
expect(subject[:geo_areas].first.key?(:numero)).to be_falsey
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue