Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-08-01 11:54:23 +0300
committerSean McGivern <sean@mcgivern.me.uk>2018-08-01 11:54:23 +0300
commitbd659f70b18be07dac184ca249c7eee17c703e56 (patch)
tree0c2091386dc5528f27928d1c5868eea2f140226e /spec/support
parente53e4d45296c32e699b98cefdcb4bcde5e1a44bf (diff)
parent60943a60d822ea490c65914ca3cec5a488742c93 (diff)
Merge branch 'fj-6860-instance-level-project-templates' into 'master'
[CE Port]: Implement instance level project templates See merge request gitlab-org/gitlab-ce!20761
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/gitlab_projects_import_service_shared_examples.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/spec/support/shared_examples/gitlab_projects_import_service_shared_examples.rb b/spec/support/shared_examples/gitlab_projects_import_service_shared_examples.rb
new file mode 100644
index 00000000000..b8db35a6ef9
--- /dev/null
+++ b/spec/support/shared_examples/gitlab_projects_import_service_shared_examples.rb
@@ -0,0 +1,54 @@
+shared_examples 'gitlab projects import validations' do
+ context 'with an invalid path' do
+ let(:path) { '/invalid-path/' }
+
+ it 'returns an invalid project' do
+ project = subject.execute
+
+ expect(project).not_to be_persisted
+ expect(project).not_to be_valid
+ end
+ end
+
+ context 'with a valid path' do
+ it 'creates a project' do
+ project = subject.execute
+
+ expect(project).to be_persisted
+ 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
+
+ context 'when there is a project with the same path' do
+ let(:existing_project) { create(:project, namespace: namespace) }
+ let(:path) { existing_project.path}
+
+ it 'does not create the project' do
+ project = subject.execute
+
+ expect(project).to be_invalid
+ expect(project).not_to be_persisted
+ end
+
+ context 'when overwrite param is set' do
+ let(:overwrite) { true }
+
+ it 'creates a project in a temporary full_path' do
+ project = subject.execute
+
+ expect(project).to be_valid
+ expect(project).to be_persisted
+ end
+ end
+ end
+end