QuartiersPrioritaires::Adapter → QuartiersPrioritairesAdapter
This commit is contained in:
parent
918a91a985
commit
5db4de6c53
4 changed files with 5 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
class ApiCarto::QuartiersPrioritaires::Adapter
|
class ApiCarto::QuartiersPrioritairesAdapter
|
||||||
def initialize(coordinates)
|
def initialize(coordinates)
|
||||||
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
|
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
|
||||||
end
|
end
|
|
@ -25,7 +25,7 @@ class ModuleApiCartoService
|
||||||
|
|
||||||
def self.generate_qp(coordinates)
|
def self.generate_qp(coordinates)
|
||||||
coordinates.flat_map do |coordinate|
|
coordinates.flat_map do |coordinate|
|
||||||
ApiCarto::QuartiersPrioritaires::Adapter.new(
|
ApiCarto::QuartiersPrioritairesAdapter.new(
|
||||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||||
).results
|
).results
|
||||||
end
|
end
|
||||||
|
|
|
@ -113,7 +113,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
let(:module_api_carto) { create(:module_api_carto, :with_quartiers_prioritaires) }
|
let(:module_api_carto) { create(:module_api_carto, :with_quartiers_prioritaires) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(ApiCarto::QuartiersPrioritaires::Adapter)
|
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
|
||||||
.to receive(:results)
|
.to receive(:results)
|
||||||
.and_return([{ :code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
.and_return([{ :code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(ApiCarto::QuartiersPrioritaires::Adapter)
|
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
|
||||||
.to receive(:results)
|
.to receive(:results)
|
||||||
.and_return([{ :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
.and_return([{ :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ApiCarto::QuartiersPrioritaires::Adapter do
|
describe ApiCarto::QuartiersPrioritairesAdapter do
|
||||||
subject { described_class.new(coordinates).results }
|
subject { described_class.new(coordinates).results }
|
||||||
|
|
||||||
before do
|
before do
|
Loading…
Add table
Add a link
Reference in a new issue