diff options
Diffstat (limited to 'spec/services/users/destroy_service_spec.rb')
-rw-r--r-- | spec/services/users/destroy_service_spec.rb | 16 |
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) |