diff options
Diffstat (limited to 'spec/features/profile_spec.rb')
-rw-r--r-- | spec/features/profile_spec.rb | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 2836ac2f801..913c375f909 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -27,17 +27,41 @@ RSpec.describe 'Profile account page', :js do expect(User.exists?(user.id)).to be_truthy end - it 'deletes user', :js, :sidekiq_might_not_need_inline do - click_button 'Delete account' + context 'when user_destroy_with_limited_execution_time_worker is enabled' do + it 'deletes user', :js, :sidekiq_inline do + click_button 'Delete account' - fill_in 'password', with: user.password + fill_in 'password', with: user.password - page.within '.modal' do - click_button 'Delete account' + page.within '.modal' do + click_button 'Delete account' + end + + expect(page).to have_content('Account scheduled for removal') + expect( + Users::GhostUserMigration.where(user: user, + initiator_user: user) + ).to be_exists end + end - expect(page).to have_content('Account scheduled for removal') - expect(User.exists?(user.id)).to be_falsy + 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 + + it 'deletes user', :js, :sidekiq_inline do + click_button 'Delete account' + + fill_in 'password', with: user.password + + page.within '.modal' do + click_button 'Delete account' + end + + expect(page).to have_content('Account scheduled for removal') + expect(User.exists?(user.id)).to be_falsy + end end it 'shows invalid password flash message', :js do |