diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-04-05 18:18:49 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-04-05 18:18:49 +0300 |
commit | 082bf1c6ee97aefc9c53e7462cf870ce8ce0ad2b (patch) | |
tree | 68f6bbf147404ee8c273170c41e89882299969ea /spec/services/projects | |
parent | b2a7faa5a9223811884676bb1004f97fb8a18a54 (diff) | |
parent | 902cec12b5b531434ccf7ecf6df22ddb4249c253 (diff) |
Merge branch 'bvl-override-import-params' into 'master'
Allow passing params to import API to override project attributes
Closes gitlab-ee#4788
See merge request gitlab-org/gitlab-ce!18086
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/gitlab_projects_import_service_spec.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/spec/services/projects/gitlab_projects_import_service_spec.rb b/spec/services/projects/gitlab_projects_import_service_spec.rb index 6b8f9619bc4..880b2aae66a 100644 --- a/spec/services/projects/gitlab_projects_import_service_spec.rb +++ b/spec/services/projects/gitlab_projects_import_service_spec.rb @@ -2,8 +2,10 @@ require 'spec_helper' describe Projects::GitlabProjectsImportService do set(:namespace) { create(:namespace) } + let(:path) { 'test-path' } let(:file) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } - subject { described_class.new(namespace.owner, { namespace_id: namespace.id, path: path, file: file }) } + let(:import_params) { { namespace_id: namespace.id, path: path, file: file } } + subject { described_class.new(namespace.owner, import_params) } describe '#execute' do context 'with an invalid path' do @@ -18,8 +20,6 @@ describe Projects::GitlabProjectsImportService do end context 'with a valid path' do - let(:path) { 'test-path' } - it 'creates a project' do project = subject.execute @@ -27,5 +27,15 @@ describe Projects::GitlabProjectsImportService do expect(project).to be_valid end end + + context 'override params' do + it 'stores them as import data when passed' do + project = described_class + .new(namespace.owner, import_params, description: 'Hello') + .execute + + expect(project.import_data.data['override_params']['description']).to eq('Hello') + end + end end end |