diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/lib/bulk_imports/clients/http_spec.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/lib/bulk_imports/clients/http_spec.rb')
-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 |