corretti bug sull'invio email
This commit is contained in:
@@ -85,6 +85,33 @@ class Mailings::OutboundQueueTest < ActiveSupport::TestCase
|
||||
assert_equal "queued", recipient_a.status
|
||||
assert_match(/Da ritentare \(1\/8\)/, recipient_a.error_message)
|
||||
assert_equal recipient_b.id, Mailings::OutboundQueue.next_queued.id
|
||||
|
||||
# Il contatore deve avanzare sullo stesso destinatario (prima il regex
|
||||
# non matchava "Da ritentare (N/8)" e restava sempre tentativo 1).
|
||||
begin
|
||||
gate.define_singleton_method(:deliver) { raise EOFError, "end of file reached" }
|
||||
assert_equal :deferred, recipient_a.deliver_queued!
|
||||
ensure
|
||||
gate.define_singleton_method(:deliver, original)
|
||||
end
|
||||
assert_match(/Da ritentare \(2\/8\)/, recipient_a.reload.error_message)
|
||||
end
|
||||
|
||||
test "next_queued skips recipients whose send window is closed" do
|
||||
open_org = create_campaign_org(name: "Club Aperto", email: "aperto@example.com")
|
||||
closed_org = create_campaign_org(name: "Club Chiuso", email: "chiuso@example.com")
|
||||
open_mailing = create_sending_mailing(name: "Finestra aperta")
|
||||
closed_mailing = create_sending_mailing(name: "Finestra chiusa")
|
||||
closed_mailing.update!(send_window_enabled: true, send_window_start_minutes: 8 * 60, send_window_end_minutes: 9 * 60)
|
||||
open_mailing.update!(send_window_enabled: false)
|
||||
|
||||
closed_recipient = enqueue_org(closed_mailing, closed_org)
|
||||
open_recipient = enqueue_org(open_mailing, open_org)
|
||||
closed_recipient.update_columns(updated_at: 1.hour.ago)
|
||||
|
||||
travel_to Time.zone.local(2026, 9, 10, 20, 0, 0) do
|
||||
assert_equal open_recipient.id, Mailings::OutboundQueue.next_queued.id
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user