summaryrefslogtreecommitdiff
path: root/spec/models/spam_log_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/spam_log_spec.rb')
-rw-r--r--spec/models/spam_log_spec.rb34
1 files changed, 28 insertions, 6 deletions
diff --git a/spec/models/spam_log_spec.rb b/spec/models/spam_log_spec.rb
index 97a0dc27f17..a40c7c5c892 100644
--- a/spec/models/spam_log_spec.rb
+++ b/spec/models/spam_log_spec.rb
@@ -21,15 +21,37 @@ RSpec.describe SpamLog do
end
context 'when admin mode is enabled', :enable_admin_mode do
- it 'removes the user', :sidekiq_might_not_need_inline do
- spam_log = build(:spam_log)
- user = spam_log.user
+ context 'when user_destroy_with_limited_execution_time_worker is enabled' do
+ it 'initiates user removal', :sidekiq_inline do
+ spam_log = build(:spam_log)
+ user = spam_log.user
+
+ perform_enqueued_jobs do
+ spam_log.remove_user(deleted_by: admin)
+ end
+
+ expect(
+ Users::GhostUserMigration.where(user: user,
+ initiator_user: admin)
+ ).to be_exists
+ end
+ end
- perform_enqueued_jobs do
- spam_log.remove_user(deleted_by: admin)
+ 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 { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound)
+ it 'removes the user', :sidekiq_inline do
+ spam_log = build(:spam_log)
+ user = spam_log.user
+
+ perform_enqueued_jobs do
+ spam_log.remove_user(deleted_by: admin)
+ end
+
+ expect { User.find(user.id) }.to raise_error(ActiveRecord::RecordNotFound)
+ end
end
end