Expose multiple user selections on champ carte

This commit is contained in:
Paul Chavard 2020-04-09 17:32:20 +02:00
parent 55e99a323c
commit 22604013d0
14 changed files with 230 additions and 245 deletions

View file

@ -13,11 +13,10 @@ describe Champs::CarteController, type: :controller do
champ_id: champ.id
}
end
let(:geojson) { [] }
let(:champ) do
create(:type_de_champ_carte, options: {
cadastres: true
}).champ.create(dossier: dossier, value: geojson.to_json)
}).champ.create(dossier: dossier)
end
describe 'POST #show' do
@ -31,7 +30,7 @@ describe Champs::CarteController, type: :controller do
allow_any_instance_of(ApiCarto::CadastreAdapter)
.to receive(:results)
.and_return([{ code: "QPCODE1234", surface_parcelle: 4, geometry: { type: "MultiPolygon", coordinates: [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
.and_return([{ code: "QPCODE1234", surface_parcelle: 4, geometry: { type: "MultiPolygon", coordinates: [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061], [2.38724851642620, 48.8721392348064], [2.38715792094576, 48.8723062632126]]]] } }])
post :show, params: params, format: 'js'
end
@ -43,7 +42,7 @@ describe Champs::CarteController, type: :controller do
expect(assigns(:error)).to eq(nil)
expect(champ.reload.value).to eq(nil)
expect(champ.reload.geo_areas).to eq([])
expect(response.body).to include("DS.fire('carte:update', {\"selector\":\".carte-1\",\"data\":{\"position\":{\"lon\":\"2.428462\",\"lat\":\"46.538192\",\"zoom\":\"13\"},\"selection\":null,\"quartiersPrioritaires\":[],\"cadastres\":[],\"parcellesAgricoles\":[]}});")
expect(response.body).to include("DS.fire('carte:update'")
}
end
@ -56,7 +55,6 @@ describe Champs::CarteController, type: :controller do
end
context 'when error' do
let(:geojson) { [[{ "lat": 48.87442541960633, "lng": 2.3859214782714844 }, { "lat": 48.87273183590832, "lng": 2.3850631713867183 }, { "lat": 48.87081237174292, "lng": 2.3809432983398438 }, { "lat": 48.8712640169951, "lng": 2.377510070800781 }, { "lat": 48.87510283703279, "lng": 2.3778533935546875 }, { "lat": 48.87544154230615, "lng": 2.382831573486328 }, { "lat": 48.87442541960633, "lng": 2.3859214782714844 }]] }
let(:value) { '' }
it {