From 145880555e1291d2a61ff9f86619b568b216e0e0 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Mon, 15 Oct 2018 22:37:59 +0200 Subject: [PATCH] =?UTF-8?q?ApiAdresse::PointAdapter#point=20=E2=86=92=20#g?= =?UTF-8?q?eocode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/lib/api_adresse/geocodeur.rb | 2 +- app/lib/api_adresse/point_adapter.rb | 2 +- spec/lib/api_adresse/geocodeur_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/lib/api_adresse/geocodeur.rb b/app/lib/api_adresse/geocodeur.rb index d2cf40607..8e2dc19c9 100644 --- a/app/lib/api_adresse/geocodeur.rb +++ b/app/lib/api_adresse/geocodeur.rb @@ -1,6 +1,6 @@ class ApiAdresse::Geocodeur def self.convert_adresse_to_point(address) - ApiAdresse::PointAdapter.new(address).point + ApiAdresse::PointAdapter.new(address).geocode rescue RestClient::Exception, JSON::ParserError => e Rails.logger.error(e.message) nil diff --git a/app/lib/api_adresse/point_adapter.rb b/app/lib/api_adresse/point_adapter.rb index 2cab33304..a8caa1e16 100644 --- a/app/lib/api_adresse/point_adapter.rb +++ b/app/lib/api_adresse/point_adapter.rb @@ -3,7 +3,7 @@ class ApiAdresse::PointAdapter @address = address end - def point + def geocode @point ||= convert_api_result_to_point end diff --git a/spec/lib/api_adresse/geocodeur_spec.rb b/spec/lib/api_adresse/geocodeur_spec.rb index 5f8e0ec34..6094caed0 100644 --- a/spec/lib/api_adresse/geocodeur_spec.rb +++ b/spec/lib/api_adresse/geocodeur_spec.rb @@ -16,7 +16,7 @@ describe ApiAdresse::Geocodeur do end context 'when JSON::ParserError' do before do - allow_any_instance_of(ApiAdresse::PointAdapter).to receive(:point).and_raise(JSON::ParserError) + allow_any_instance_of(ApiAdresse::PointAdapter).to receive(:geocode).and_raise(JSON::ParserError) end it 'return nil' do expect(described_class.convert_adresse_to_point(address)).to be_nil