summaryrefslogtreecommitdiff
path: root/spec/services/users/destroy_service_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 15:07:55 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-14 15:07:55 +0000
commit85e494935a8726dc98bb19ffa584488420e5011e (patch)
tree5acf279dab81a2363e4504a9679c32c16510542b /spec/services/users/destroy_service_spec.rb
parent4ce0bee95df15c05cdb0d777eba31fe753bc443b (diff)
downloadgitlab-ce-85e494935a8726dc98bb19ffa584488420e5011e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/users/destroy_service_spec.rb')
-rw-r--r--spec/services/users/destroy_service_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb
index 23a0c71175e..d9335cef5cc 100644
--- a/spec/services/users/destroy_service_spec.rb
+++ b/spec/services/users/destroy_service_spec.rb
@@ -20,6 +20,22 @@ describe Users::DestroyService do
expect { Namespace.find(namespace.id) }.to raise_error(ActiveRecord::RecordNotFound)
end
+ it 'deletes user associations in batches' do
+ expect(user).to receive(:destroy_dependent_associations_in_batches)
+
+ service.execute(user)
+ end
+
+ context 'when :destroy_user_associations_in_batches flag is disabled' do
+ it 'does not delete user associations in batches' do
+ stub_feature_flags(destroy_user_associations_in_batches: false)
+
+ expect(user).not_to receive(:destroy_dependent_associations_in_batches)
+
+ service.execute(user)
+ end
+ end
+
it 'will delete the project' do
expect_next_instance_of(Projects::DestroyService) do |destroy_service|
expect(destroy_service).to receive(:execute).once.and_return(true)