diff options
Diffstat (limited to 'spec/services/resource_access_tokens')
-rw-r--r-- | spec/services/resource_access_tokens/revoke_service_spec.rb | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/spec/services/resource_access_tokens/revoke_service_spec.rb b/spec/services/resource_access_tokens/revoke_service_spec.rb index 3d724a79fef..8f89696cc55 100644 --- a/spec/services/resource_access_tokens/revoke_service_spec.rb +++ b/spec/services/resource_access_tokens/revoke_service_spec.rb @@ -29,18 +29,35 @@ RSpec.describe ResourceAccessTokens::RevokeService do expect(resource.reload.users).not_to include(resource_bot) end - it 'transfer issuables of bot user to ghost user' do - issue = create(:issue, author: resource_bot) + context 'when user_destroy_with_limited_execution_time_worker is enabled' do + it 'initiates user removal' do + subject + + expect( + Users::GhostUserMigration.where(user: resource_bot, + initiator_user: user) + ).to be_exists + end + end - subject + context 'when user_destroy_with_limited_execution_time_worker is disabled' do + before do + stub_feature_flags(user_destroy_with_limited_execution_time_worker: false) + end - expect(issue.reload.author.ghost?).to be true - end + it 'transfer issuables of bot user to ghost user' do + issue = create(:issue, author: resource_bot) - it 'deletes project bot user' do - subject + subject + + expect(issue.reload.author.ghost?).to be true + end + + it 'deletes project bot user' do + subject - expect(User.exists?(resource_bot.id)).to be_falsy + expect(User.exists?(resource_bot.id)).to be_falsy + end end it 'logs the event' do |