summaryrefslogtreecommitdiff
path: root/spec/services/projects/create_from_template_service_spec.rb
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-07-26 14:21:53 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-07-28 11:32:46 +0200
commit1d3815f89b9b9f5ecfd6dd15158a2988603b9ed8 (patch)
treea694e1e05f58fc3fe5ae00135d4a439eef7c8150 /spec/services/projects/create_from_template_service_spec.rb
parentd964816b9fe56679ffc0b331e701f7b24db5c6a9 (diff)
downloadgitlab-ce-1d3815f89b9b9f5ecfd6dd15158a2988603b9ed8.tar.gz
Allow projects to be started from a template
Started implementation for the first iteration of gitlab-org/gitlab-ce#32420. This will allow users to select a template to start with, instead of an empty repository in the project just created. Internally this is basically a small extension of the ImportExport GitLab projects we already support. We just import a certain import tar archive. This commits includes the first one: Ruby on Rails. In the future more will be added.
Diffstat (limited to 'spec/services/projects/create_from_template_service_spec.rb')
-rw-r--r--spec/services/projects/create_from_template_service_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/services/projects/create_from_template_service_spec.rb b/spec/services/projects/create_from_template_service_spec.rb
new file mode 100644
index 00000000000..81e88c0862d
--- /dev/null
+++ b/spec/services/projects/create_from_template_service_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+describe Projects::CreateFromTemplateService do
+ let(:user) { create(:user) }
+ let(:project_params) do
+ {
+ path: user.to_param,
+ template_title: 'rails'
+ }
+ end
+
+ subject { described_class.new(user, project_params) }
+
+ it 'calls the importer service' do
+ expect_any_instance_of(Projects::GitlabProjectsImporterService).to receive(:execute)
+
+ subject.execute
+ end
+
+ it 'returns the project thats created' do
+ project = subject.execute
+
+ expect(project).to be_saved
+ expect(project.import_status).to eq('scheduled')
+ end
+end