summaryrefslogtreecommitdiff
path: root/spec/services
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-03-29 13:57:21 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-04-04 19:49:48 +0200
commite40c0085ef300aca38076af3ea2f227761084038 (patch)
tree46f24452583fe738e4e1117d8a7d149de078397d /spec/services
parent11a9fbe65b22c334bc47edf0a23b89619766553d (diff)
downloadgitlab-ce-e40c0085ef300aca38076af3ea2f227761084038.tar.gz
Store override params as import data on projects
This means import data doesn't necessarily have to have an import_url anymore. The `ProjectImportData` could just contain the override data in it's serialized data attribute. The import data is automatically cleaned up after it is finished by the state machine.
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/projects/gitlab_projects_import_service_spec.rb16
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