ApiAdresse::PointAdapter#point → #geocode
This commit is contained in:
parent
af716fa3c6
commit
145880555e
3 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@ class ApiAdresse::PointAdapter
|
|||
@address = address
|
||||
end
|
||||
|
||||
def point
|
||||
def geocode
|
||||
@point ||= convert_api_result_to_point
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue