summaryrefslogtreecommitdiff
path: root/spec/services/users/destroy_service_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-03 22:23:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-03 22:23:33 +0000
commit6c3124c854cbeef391a38b5ae8330174d78348bf (patch)
treeaf77629bc34ccc517ed24d9db35895be5d02d23d /spec/services/users/destroy_service_spec.rb
parent9a8ae3b4e90e56f71bb770463b943512efdcd1d1 (diff)
downloadgitlab-ce-6c3124c854cbeef391a38b5ae8330174d78348bf.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-ee
Diffstat (limited to 'spec/services/users/destroy_service_spec.rb')
-rw-r--r--spec/services/users/destroy_service_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb
index 45dbe83b496..90c4f70d749 100644
--- a/spec/services/users/destroy_service_spec.rb
+++ b/spec/services/users/destroy_service_spec.rb
@@ -215,6 +215,27 @@ RSpec.describe Users::DestroyService do
end
end
+ context 'deletions with inherited group owners' do
+ let(:group) { create(:group, :nested) }
+ let(:user) { create(:user) }
+ let(:inherited_owner) { create(:user) }
+
+ before do
+ group.parent.add_owner(inherited_owner)
+ group.add_owner(user)
+
+ service.execute(user, delete_solo_owned_groups: true)
+ end
+
+ it 'does not delete the group' do
+ expect(Group.exists?(id: group)).to be_truthy
+ end
+
+ it 'deletes the user' do
+ expect(User.exists?(id: user)).to be_falsey
+ end
+ end
+
context 'migrating associated records' do
let!(:issue) { create(:issue, author: user) }