ApiAdresse::PointAdapter#point → #geocode

This commit is contained in:
gregoirenovel 2018-10-15 22:37:59 +02:00
parent af716fa3c6
commit 145880555e
3 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -3,7 +3,7 @@ class ApiAdresse::PointAdapter
@address = address
end
def point
def geocode
@point ||= convert_api_result_to_point
end

View file

@ -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