summaryrefslogtreecommitdiff
path: root/spec/services/users/destroy_service_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/users/destroy_service_spec.rb')
-rw-r--r--spec/services/users/destroy_service_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb
index 6e4b293286b..3db5e66fe05 100644
--- a/spec/services/users/destroy_service_spec.rb
+++ b/spec/services/users/destroy_service_spec.rb
@@ -67,6 +67,18 @@ describe Users::DestroyService do
end
end
+ it 'calls the bulk snippet destroy service with hard delete option if it is present' do
+ # this avoids getting into Projects::DestroyService as it would
+ # call Snippets::BulkDestroyService first!
+ allow(user).to receive(:personal_projects).and_return([])
+
+ expect_next_instance_of(Snippets::BulkDestroyService) do |bulk_destroy_service|
+ expect(bulk_destroy_service).to receive(:execute).with(hard_delete: true).and_call_original
+ end
+
+ service.execute(user, hard_delete: true)
+ end
+
it 'does not delete project snippets that the user is the author of' do
repo = create(:project_snippet, :repository, author: user).snippet_repository
service.execute(user)