From 4c398b3c85805bb949aa012966cf6d403dad7d10 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 15 Jul 2026 16:19:31 +0530 Subject: [PATCH] test(automations): account flag off pauses the row and resumes on re-enable --- .../process_pending_execution_job_spec.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/jobs/automation_rules/process_pending_execution_job_spec.rb b/spec/jobs/automation_rules/process_pending_execution_job_spec.rb index fbde4fd01..887b1235b 100644 --- a/spec/jobs/automation_rules/process_pending_execution_job_spec.rb +++ b/spec/jobs/automation_rules/process_pending_execution_job_spec.rb @@ -37,12 +37,18 @@ RSpec.describe AutomationRules::ProcessPendingExecutionJob do expect(conversation.reload.label_list).to be_empty end - it 'skips with flag_disabled when the account flag was turned off' do + it 'pauses (keeps pending) while the account flag is off, then fires when re-enabled' do account.disable_features!('delayed_automations') job.perform(pending_execution.reload) - expect(pending_execution.reload).to be_skipped - expect(pending_execution.skip_reason).to eq('flag_disabled') + expect(pending_execution.reload).to be_pending + expect(conversation.reload.label_list).to be_empty + + account.enable_features!('delayed_automations') + described_class.new.perform(pending_execution.reload) + + expect(pending_execution.reload).to be_executed + expect(conversation.reload.label_list).to include('stale') end it 'skips with episode_moved when the conversation left the armed status' do