QuartiersPrioritaires::Adapter → QuartiersPrioritairesAdapter

This commit is contained in:
gregoirenovel 2018-10-15 17:16:55 +02:00
parent 918a91a985
commit 5db4de6c53
4 changed files with 5 additions and 5 deletions

View file

@ -1,4 +1,4 @@
class ApiCarto::QuartiersPrioritaires::Adapter
class ApiCarto::QuartiersPrioritairesAdapter
def initialize(coordinates)
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
end

View file

@ -25,7 +25,7 @@ class ModuleApiCartoService
def self.generate_qp(coordinates)
coordinates.flat_map do |coordinate|
ApiCarto::QuartiersPrioritaires::Adapter.new(
ApiCarto::QuartiersPrioritairesAdapter.new(
coordinate.map { |element| [element['lng'], element['lat']] }
).results
end

View file

@ -113,7 +113,7 @@ shared_examples 'carte_controller_spec' do
let(:module_api_carto) { create(:module_api_carto, :with_quartiers_prioritaires) }
before do
allow_any_instance_of(ApiCarto::QuartiersPrioritaires::Adapter)
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
.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]]]] } }])
@ -215,7 +215,7 @@ shared_examples 'carte_controller_spec' do
render_views
before do
allow_any_instance_of(ApiCarto::QuartiersPrioritaires::Adapter)
allow_any_instance_of(ApiCarto::QuartiersPrioritairesAdapter)
.to receive(:results)
.and_return([{ :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe ApiCarto::QuartiersPrioritaires::Adapter do
describe ApiCarto::QuartiersPrioritairesAdapter do
subject { described_class.new(coordinates).results }
before do