From 107292dd3ab26489ab8fe613b9b3185aa6d66087 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 3 Aug 2018 13:07:50 +0200 Subject: Fix spec warnings and template helper --- ...tlab_projects_import_service_shared_examples.rb | 54 ---------------------- ...tlab_projects_import_service_shared_examples.rb | 54 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 spec/support/shared_examples/gitlab_projects_import_service_shared_examples.rb create mode 100644 spec/support/shared_examples/services/gitlab_projects_import_service_shared_examples.rb (limited to 'spec/support') 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 deleted file mode 100644 index b8db35a6ef9..00000000000 --- a/spec/support/shared_examples/gitlab_projects_import_service_shared_examples.rb +++ /dev/null @@ -1,54 +0,0 @@ -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 diff --git a/spec/support/shared_examples/services/gitlab_projects_import_service_shared_examples.rb b/spec/support/shared_examples/services/gitlab_projects_import_service_shared_examples.rb new file mode 100644 index 00000000000..b8db35a6ef9 --- /dev/null +++ b/spec/support/shared_examples/services/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 -- cgit v1.2.1