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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-30 16:24:08 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-03-30 16:24:08 +0300
commit236c9c170374190bcb6dc54a1ca3dddda2d3dcb2 (patch)
treeaeb4ecd5fcced3f7c71d8639f0a3a8c3517089fa /spec/services
parent003a51d17aea6af92953f7207e2b39a5cb6db8de (diff)
Simplify how we create container registry resources
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/container_registry/create_repository_service_spec.rb75
1 files changed, 0 insertions, 75 deletions
diff --git a/spec/services/container_registry/create_repository_service_spec.rb b/spec/services/container_registry/create_repository_service_spec.rb
deleted file mode 100644
index ac7b147f92e..00000000000
--- a/spec/services/container_registry/create_repository_service_spec.rb
+++ /dev/null
@@ -1,75 +0,0 @@
-require 'spec_helper'
-
-describe ContainerRegistry::CreateRepositoryService, '#execute' do
- let(:project) { create(:empty_project) }
- let(:user) { create(:user) }
-
- let(:path) do
- ContainerRegistry::Path.new("#{project.full_path}/my/image")
- end
-
- let(:service) { described_class.new(project, user) }
-
- before do
- stub_container_registry_config(enabled: true)
- end
-
- context 'when repository is created by an user' do
- context 'when user has no ability to create a repository' do
- it 'does not create a new container repository' do
- expect { service.execute(path) }
- .to raise_error(Gitlab::Access::AccessDeniedError)
- .and change { ContainerRepository.count }.by(0)
- end
- end
-
- context 'when user has ability do create a repository' do
- before do
- project.add_developer(user)
- end
-
- context 'when repository already exists' do
- before do
- create(:container_repository, project: project, name: 'my/image')
- end
-
- it 'does not create container repository again' do
- expect { service.execute(path) }
- .to_not change { ContainerRepository.count }
- end
- end
-
- context 'when repository does not exist yet' do
- it 'creates a new container repository' do
- expect { service.execute(path) }
- .to change { project.container_repositories.count }.by(1)
- end
- end
- end
- end
-
- context 'when repository is created by a legacy pipeline trigger' do
- let(:user) { nil }
-
- context 'when repository path matches authenticated project' do
- it 'creates a new container repository' do
- expect { service.execute(path) }
- .to change { project.container_repositories.count }.by(1)
- end
- end
-
- context 'when repository path does not match authenticated project' do
- let(:private_project) { create(:empty_project, :private) }
-
- let(:path) do
- ContainerRegistry::Path.new("#{private_project.full_path}/my/image")
- end
-
- it 'does not create a new container repository' do
- expect { service.execute(path) }
- .to raise_error(Gitlab::Access::AccessDeniedError)
- .and change { ContainerRepository.count }.by(0)
- end
- end
- end
-end