ApiAdresse::AddressAdapter#list → #get_suggestions
This commit is contained in:
parent
517c0ad3fc
commit
7af41b35a2
3 changed files with 4 additions and 4 deletions
|
@ -2,7 +2,7 @@ class Ban::SearchController < ApplicationController
|
|||
def get
|
||||
request = params[:request]
|
||||
|
||||
json = ApiAdresse::AddressAdapter.new(request).list.map do |value|
|
||||
json = ApiAdresse::AddressAdapter.new(request).get_suggestions.map do |value|
|
||||
{ label: value }
|
||||
end.to_json
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ class ApiAdresse::AddressAdapter
|
|||
@address = address
|
||||
end
|
||||
|
||||
def list
|
||||
def get_suggestions
|
||||
@list ||= convert_api_result_to_full_address
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ApiAdresse::AddressAdapter do
|
||||
describe '#list' do
|
||||
describe '#get_suggestions' do
|
||||
let(:request) { 'Paris' }
|
||||
let(:response) { File.open('spec/support/files/api_adresse/search_results.json') }
|
||||
let(:status) { 200 }
|
||||
|
||||
subject { described_class.new(request).list }
|
||||
subject { described_class.new(request).get_suggestions }
|
||||
|
||||
before do
|
||||
stub_request(:get, "https://api-adresse.data.gouv.fr/search?&q=#{request}&limit=5")
|
||||
|
|
Loading…
Reference in a new issue