diff options
Diffstat (limited to 'spec/support/shared_examples/requests/access_tokens_controller_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/requests/access_tokens_controller_shared_examples.rb | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/spec/support/shared_examples/requests/access_tokens_controller_shared_examples.rb b/spec/support/shared_examples/requests/access_tokens_controller_shared_examples.rb index 6cd871d354c..017e6274cb0 100644 --- a/spec/support/shared_examples/requests/access_tokens_controller_shared_examples.rb +++ b/spec/support/shared_examples/requests/access_tokens_controller_shared_examples.rb @@ -108,18 +108,31 @@ RSpec.shared_examples 'PUT resource access tokens available' do expect(resource.reload.bots).not_to include(bot_user) end - it 'converts issuables of the bot user to ghost user' do - issue = create(:issue, author: bot_user) + context 'when user_destroy_with_limited_execution_time_worker is enabled' do + it 'creates GhostUserMigration records to handle migration in a worker' do + expect { subject }.to( + change { Users::GhostUserMigration.count }.from(0).to(1)) + 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 'converts issuables of the bot user to ghost user' do + issue = create(:issue, author: bot_user) - it 'deletes project bot user' do - subject + subject + + expect(issue.reload.author.ghost?).to be true + end - expect(User.exists?(bot_user.id)).to be_falsy + it 'deletes project bot user' do + subject + + expect(User.exists?(bot_user.id)).to be_falsy + end end context 'when unsuccessful' do |