diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-05-19 10:33:21 +0300 |
commit | 36a59d088eca61b834191dacea009677a96c052f (patch) | |
tree | e4f33972dab5d8ef79e3944a9f403035fceea43f /spec/services/users/destroy_service_spec.rb | |
parent | a1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'spec/services/users/destroy_service_spec.rb')
-rw-r--r-- | spec/services/users/destroy_service_spec.rb | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/spec/services/users/destroy_service_spec.rb b/spec/services/users/destroy_service_spec.rb index 80a506bb1d6..45dbe83b496 100644 --- a/spec/services/users/destroy_service_spec.rb +++ b/spec/services/users/destroy_service_spec.rb @@ -73,10 +73,10 @@ RSpec.describe Users::DestroyService do 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 + expect(bulk_destroy_service).to receive(:execute).with({ hard_delete: true }).and_call_original end - service.execute(user, hard_delete: true) + service.execute(user, { hard_delete: true }) end it 'does not delete project snippets that the user is the author of' do @@ -336,35 +336,24 @@ RSpec.describe Users::DestroyService do context 'batched nullify' do let(:other_user) { create(:user) } - context 'when :nullify_in_batches_on_user_deletion feature flag is enabled' do - it 'nullifies related associations in batches' do - expect(other_user).to receive(:nullify_dependent_associations_in_batches).and_call_original + it 'nullifies related associations in batches' do + expect(other_user).to receive(:nullify_dependent_associations_in_batches).and_call_original - described_class.new(user).execute(other_user, skip_authorization: true) - end - - it 'nullifies last_updated_issues and closed_issues' do - issue = create(:issue, closed_by: other_user, updated_by: other_user) - - described_class.new(user).execute(other_user, skip_authorization: true) - - issue.reload - - expect(issue.closed_by).to be_nil - expect(issue.updated_by).to be_nil - end + described_class.new(user).execute(other_user, skip_authorization: true) end - context 'when :nullify_in_batches_on_user_deletion feature flag is disabled' do - before do - stub_feature_flags(nullify_in_batches_on_user_deletion: false) - end + it 'nullifies last_updated_issues, closed_issues, resource_label_events' do + issue = create(:issue, closed_by: other_user, updated_by: other_user) + resource_label_event = create(:resource_label_event, user: other_user) - it 'does not use batching' do - expect(other_user).not_to receive(:nullify_dependent_associations_in_batches) + described_class.new(user).execute(other_user, skip_authorization: true) - described_class.new(user).execute(other_user, skip_authorization: true) - end + issue.reload + resource_label_event.reload + + expect(issue.closed_by).to be_nil + expect(issue.updated_by).to be_nil + expect(resource_label_event.user).to be_nil end end end |