diff options
Diffstat (limited to 'spec/lib/bulk_imports/clients/http_spec.rb')
-rw-r--r-- | spec/lib/bulk_imports/clients/http_spec.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/lib/bulk_imports/clients/http_spec.rb b/spec/lib/bulk_imports/clients/http_spec.rb index aff049408e2..bf1bfb77b26 100644 --- a/spec/lib/bulk_imports/clients/http_spec.rb +++ b/spec/lib/bulk_imports/clients/http_spec.rb @@ -33,11 +33,17 @@ RSpec.describe BulkImports::Clients::HTTP, feature_category: :importers do end context 'error handling' do - context 'when error occurred' do - it 'raises BulkImports::NetworkError' do - allow(Gitlab::HTTP).to receive(method).and_raise(Errno::ECONNREFUSED) + context 'when any known HTTP error occurs' do + using RSpec::Parameterized::TableSyntax + + where(:exception_class) { Gitlab::HTTP::HTTP_ERRORS } + + with_them do + it 'raises BulkImports::NetworkError' do + allow(Gitlab::HTTP).to receive(method).and_raise(exception_class) - expect { subject.public_send(method, resource) }.to raise_exception(BulkImports::NetworkError) + expect { subject.public_send(method, resource) }.to raise_exception(BulkImports::NetworkError) + end end end |