FIX: ensures we don't exit without pending automations (#26771)
This case is not supposed to happen but it seems safer to ensure this case will recreate pending automations.
This commit is contained in:
parent
803c275bd7
commit
e7f0aa52fa
|
@ -31,7 +31,7 @@ module DiscourseAutomation
|
|||
if previous_start_date != start_date || previous_interval != interval ||
|
||||
previous_frequency != frequency
|
||||
automation.pending_automations.destroy_all
|
||||
else
|
||||
elsif automation.pending_automations.present?
|
||||
return
|
||||
end
|
||||
|
||||
|
|
|
@ -119,6 +119,16 @@ describe "Recurring" do
|
|||
}.to_not change { DiscourseAutomation::PendingAutomation.last.execute_at }
|
||||
expect(DiscourseAutomation::PendingAutomation.count).to eq(1)
|
||||
end
|
||||
|
||||
context "when there are no existing pending automations" do
|
||||
before { automation.pending_automations.destroy_all }
|
||||
|
||||
it "creates a new one" do
|
||||
expect {
|
||||
automation.upsert_field!("test", "text", { value: "somethingelse" }, target: "script")
|
||||
}.to change { DiscourseAutomation::PendingAutomation.count }.by(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue