Catch error 500 for quartier prioritaire

This commit is contained in:
Xavier J 2016-12-20 12:27:53 +01:00
parent 39a023b3e2
commit 83444ab54c
2 changed files with 13 additions and 0 deletions

View file

@ -21,6 +21,9 @@ class CARTO::SGMAP::API
url,
verify_ssl: verify_ssl_mode,
).post params[:geojson], content_type: 'application/json'
rescue RestClient::InternalServerError
raise RestClient::ResourceNotFound
end
def self.base_url

View file

@ -20,6 +20,16 @@ describe CARTO::SGMAP::API do
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
let(:geojson) { File.read('spec/support/files/geojson/request_qp.json') }
let(:status) { 200 }