Catch error 500 for quartier prioritaire
This commit is contained in:
parent
39a023b3e2
commit
83444ab54c
2 changed files with 13 additions and 0 deletions
|
@ -21,6 +21,9 @@ class CARTO::SGMAP::API
|
||||||
url,
|
url,
|
||||||
verify_ssl: verify_ssl_mode,
|
verify_ssl: verify_ssl_mode,
|
||||||
).post params[:geojson], content_type: 'application/json'
|
).post params[:geojson], content_type: 'application/json'
|
||||||
|
|
||||||
|
rescue RestClient::InternalServerError
|
||||||
|
raise RestClient::ResourceNotFound
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.base_url
|
def self.base_url
|
||||||
|
|
|
@ -20,6 +20,16 @@ describe CARTO::SGMAP::API do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when request return 500' do
|
||||||
|
let(:geojson) { File.read('spec/support/files/geojson/request_qp.json') }
|
||||||
|
let(:status) { 500 }
|
||||||
|
let(:body) { 'toto' }
|
||||||
|
|
||||||
|
it 'raises RestClient::ResourceNotFound' do
|
||||||
|
expect { subject }.to raise_error(RestClient::ResourceNotFound)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'when geojson exist' do
|
context 'when geojson exist' do
|
||||||
let(:geojson) { File.read('spec/support/files/geojson/request_qp.json') }
|
let(:geojson) { File.read('spec/support/files/geojson/request_qp.json') }
|
||||||
let(:status) { 200 }
|
let(:status) { 200 }
|
||||||
|
|
Loading…
Reference in a new issue