diff options
Diffstat (limited to 'spec/lib/bulk_imports/clients')
-rw-r--r-- | spec/lib/bulk_imports/clients/http_spec.rb | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/spec/lib/bulk_imports/clients/http_spec.rb b/spec/lib/bulk_imports/clients/http_spec.rb index 213fa23675e..ac42f12a3d4 100644 --- a/spec/lib/bulk_imports/clients/http_spec.rb +++ b/spec/lib/bulk_imports/clients/http_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe BulkImports::Clients::Http do +RSpec.describe BulkImports::Clients::HTTP do include ImportSpecHelper let(:uri) { 'http://gitlab.example' } @@ -48,6 +48,7 @@ RSpec.describe BulkImports::Clients::Http do [ 'http://gitlab.example:80/api/v4/resource', hash_including( + follow_redirects: false, query: { page: described_class::DEFAULT_PAGE, per_page: described_class::DEFAULT_PER_PAGE @@ -118,6 +119,7 @@ RSpec.describe BulkImports::Clients::Http do 'http://gitlab.example:80/api/v4/resource', hash_including( body: {}, + follow_redirects: false, headers: { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{token}" @@ -127,4 +129,42 @@ RSpec.describe BulkImports::Clients::Http do end end end + + describe '#head' do + let(:method) { :head } + + include_examples 'performs network request' do + let(:expected_args) do + [ + 'http://gitlab.example:80/api/v4/resource', + hash_including( + follow_redirects: false, + headers: { + 'Content-Type' => 'application/json', + 'Authorization' => "Bearer #{token}" + } + ) + ] + end + end + end + + describe '#stream' do + it 'performs network request with stream_body option' do + expected_args = [ + 'http://gitlab.example:80/api/v4/resource', + hash_including( + stream_body: true, + headers: { + 'Content-Type' => 'application/json', + 'Authorization' => "Bearer #{token}" + } + ) + ] + + expect(Gitlab::HTTP).to receive(:get).with(*expected_args).and_return(response_double) + + subject.stream(resource) + end + end end |