ApiCarto::Cadastre::Adapter → ApiCarto::CadastreAdapter

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

View file

@ -1,4 +1,4 @@
class ApiCarto::Cadastre::Adapter
class ApiCarto::CadastreAdapter
def initialize(coordinates)
@coordinates = GeojsonService.to_json_polygon_for_cadastre(coordinates)
end

View file

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

View file

@ -160,7 +160,7 @@ shared_examples 'carte_controller_spec' do
let(:module_api_carto) { create(:module_api_carto, :with_cadastre) }
before do
allow_any_instance_of(ApiCarto::Cadastre::Adapter)
allow_any_instance_of(ApiCarto::CadastreAdapter)
.to receive(:results)
.and_return([{ :surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => { :type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]] } }])

View file

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