Skip to content
Snippets Groups Projects
Commit c9d65b51 authored by Ando Emerencia's avatar Ando Emerencia
Browse files

added 202 for synchronous render controller

parent 6b5cdb95
Branches
Tags
1 merge request!12Added 202 for synchronous render controller
......@@ -18,6 +18,9 @@ module Fizzy
def invalid_response(response)
case response.code
when 202
raise Errors::OutcomeNotAvailableError, select_measurement_text(response,
'The results have not yet been calculated.')
when 204
raise Errors::TooFewMeasurementsError, select_measurement_text(response,
'Not enough measurements available.')
......
......@@ -30,6 +30,20 @@ module Fizzy
end
describe 'error handling' do
it 'should notice a 202' do
allow(response).to receive(:code).and_return 202
expect(session).to receive(:get)
.with("/dossier/#{dossier_id}/protocol_subscriptions/#{protocol_subscription_id}/render_sync/#{path}", options)
.and_return(response)
outcome = lambda do
described_class.run! dossier_id: dossier_id,
protocol_subscription_id: protocol_subscription_id,
path: path,
options: options
end
expect { outcome.call }.to raise_error(Errors::OutcomeNotAvailableError)
end
it 'should notice a 204' do
allow(response).to receive(:code).and_return 204
expect(session).to receive(:get)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment