summaryrefslogtreecommitdiff
path: root/spec/controllers/groups_controller_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-16 09:07:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-16 09:07:51 +0000
commit914ea32e0efca21436220df2c10e1bfbe4ed3da9 (patch)
treee8eb3b97aea2006bd863c586b7ec41d51f654b3b /spec/controllers/groups_controller_spec.rb
parent3546e1bb0971347e9e9984de0799e3fb53743b33 (diff)
downloadgitlab-ce-914ea32e0efca21436220df2c10e1bfbe4ed3da9.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/groups_controller_spec.rb')
-rw-r--r--spec/controllers/groups_controller_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index a35ef99ef12..3c39a6468e5 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -385,6 +385,29 @@ describe GroupsController do
expect(response).to have_gitlab_http_status(302)
expect(group.reload.project_creation_level).to eq(::Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
end
+
+ context 'when a project inside the group has container repositories' do
+ before do
+ stub_container_registry_config(enabled: true)
+ stub_container_registry_tags(repository: /image/, tags: %w[rc1])
+ create(:container_repository, project: project, name: :image)
+ end
+
+ it 'does allow the group to be renamed' do
+ post :update, params: { id: group.to_param, group: { name: 'new_name' } }
+
+ expect(controller).to set_flash[:notice]
+ expect(response).to have_gitlab_http_status(302)
+ expect(group.reload.name).to eq('new_name')
+ end
+
+ it 'does not allow to path of the group to be changed' do
+ post :update, params: { id: group.to_param, group: { path: 'new_path' } }
+
+ expect(assigns(:group).errors[:base].first).to match(/Docker images in their Container Registry/)
+ expect(response).to have_gitlab_http_status(200)
+ end
+ end
end
describe '#ensure_canonical_path' do
@@ -673,6 +696,28 @@ describe GroupsController do
expect(response).to have_gitlab_http_status(404)
end
end
+
+ context 'transferring when a project has container images' do
+ let(:group) { create(:group, :public, :nested) }
+ let!(:group_member) { create(:group_member, :owner, group: group, user: user) }
+
+ before do
+ stub_container_registry_config(enabled: true)
+ stub_container_registry_tags(repository: /image/, tags: %w[rc1])
+ create(:container_repository, project: project, name: :image)
+
+ put :transfer,
+ params: {
+ id: group.to_param,
+ new_parent_group_id: ''
+ }
+ end
+
+ it 'does not allow the group to be transferred' do
+ expect(controller).to set_flash[:alert].to match(/Docker images in their Container Registry/)
+ expect(response).to redirect_to(edit_group_path(group))
+ end
+ end
end
context 'token authentication' do