diff options
Diffstat (limited to 'spec/controllers/import/bulk_imports_controller_spec.rb')
-rw-r--r-- | spec/controllers/import/bulk_imports_controller_spec.rb | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/spec/controllers/import/bulk_imports_controller_spec.rb b/spec/controllers/import/bulk_imports_controller_spec.rb index dd850a86227..436daed0af6 100644 --- a/spec/controllers/import/bulk_imports_controller_spec.rb +++ b/spec/controllers/import/bulk_imports_controller_spec.rb @@ -57,8 +57,8 @@ RSpec.describe Import::BulkImportsController do let(:client_response) do double( parsed_response: [ - { 'id' => 1, 'full_name' => 'group1', 'full_path' => 'full/path/group1' }, - { 'id' => 2, 'full_name' => 'group2', 'full_path' => 'full/path/group2' } + { 'id' => 1, 'full_name' => 'group1', 'full_path' => 'full/path/group1', 'web_url' => 'http://demo.host/full/path/group1' }, + { 'id' => 2, 'full_name' => 'group2', 'full_path' => 'full/path/group2', 'web_url' => 'http://demo.host/full/path/group1' } ] ) end @@ -132,12 +132,27 @@ RSpec.describe Import::BulkImportsController do end describe 'POST create' do + let(:instance_url) { "http://fake-intance" } + let(:pat) { "fake-pat" } + + before do + session[:bulk_import_gitlab_access_token] = pat + session[:bulk_import_gitlab_url] = instance_url + end + it 'executes BulkImportService' do - expect_next_instance_of(BulkImportService) do |service| + bulk_import_params = [{ "source_type" => "group_entity", + "source_full_path" => "full_path", + "destination_name" => + "destination_name", + "destination_namespace" => "root" }] + + expect_next_instance_of( + BulkImportService, user, bulk_import_params, { url: instance_url, access_token: pat }) do |service| expect(service).to receive(:execute) end - post :create + post :create, params: { bulk_import: bulk_import_params } expect(response).to have_gitlab_http_status(:ok) end |