diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-20 03:05:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-20 03:05:59 +0300 |
commit | fc8c74fd0cbe7384038ead2dd2493f5c63d2b98d (patch) | |
tree | 6fe0229558adf41fd48c1e9f6bc5e367011d4976 /spec | |
parent | b35b9ac7e2fd4a707ea9291eb57769c690403b4c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/project_import_spec.rb | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/requests/api/project_import_spec.rb b/spec/requests/api/project_import_spec.rb index 594b42bb6c0..d2b1fb063b8 100644 --- a/spec/requests/api/project_import_spec.rb +++ b/spec/requests/api/project_import_spec.rb @@ -33,6 +33,53 @@ describe API::ProjectImport do expect(response).to have_gitlab_http_status(201) end + context 'when a name is explicitly set' do + let(:expected_name) { 'test project import' } + + it 'schedules an import using a namespace and a different name' do + stub_import(namespace) + + post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.id, name: expected_name } + + expect(response).to have_gitlab_http_status(201) + end + + it 'schedules an import using the namespace path and a different name' do + stub_import(namespace) + + post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: expected_name } + + expect(response).to have_gitlab_http_status(201) + end + + it 'sets name correctly' do + stub_import(namespace) + + post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: expected_name } + + project = Project.find(json_response['id']) + expect(project.name).to eq(expected_name) + end + + it 'sets name correctly with an overwrite' do + stub_import(namespace) + + post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: 'new project name', overwrite: true } + + project = Project.find(json_response['id']) + expect(project.name).to eq('new project name') + end + + it 'schedules an import using the path and name explicitly set to nil' do + stub_import(namespace) + + post api('/projects/import', user), params: { path: 'test-import', file: fixture_file_upload(file), namespace: namespace.full_path, name: nil } + + project = Project.find(json_response['id']) + expect(project.name).to eq('test-import') + end + end + it 'schedules an import at the user namespace level' do stub_import(user.namespace) |