fix(job): non crirtical mail must be sent into < 15min, not hours

This commit is contained in:
Colin Darie 2024-10-10 12:20:03 +02:00
parent da5de8d97a
commit 7f18db6c91
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4
4 changed files with 16 additions and 16 deletions

View file

@ -13,6 +13,6 @@ class PriorizedMailDeliveryJob < ActionMailer::MailDeliveryJob
end
def custom_queue
'low'
'default'
end
end

View file

@ -11,8 +11,8 @@ RSpec.describe AdministrateurMailer, type: :mailer do
it { expect(subject.subject).to include("La suppression automatique des dossiers a été activée sur la démarche") }
context 'when perform_later is called' do
let(:custom_queue) { 'low' }
it 'enqueues email is custom queue for low priority delivery' do
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
end
end
@ -51,8 +51,8 @@ end
it { expect(subject.body).to include("un de vos services n'a pas son siret renseigné") }
context 'when perform_later is called' do
let(:custom_queue) { 'low' }
it 'enqueues email is custom queue for low priority delivery' do
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
end
end

View file

@ -10,9 +10,9 @@ RSpec.describe InstructeurMailer, type: :mailer do
it { expect(subject.body).to include('Bonjour') }
context 'when perform_later is called' do
let(:custom_queue) { 'low' }
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for low priority delivery' do
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job(PriorizedMailDeliveryJob).on_queue(custom_queue)
end
end
@ -80,8 +80,8 @@ RSpec.describe InstructeurMailer, type: :mailer do
end
context 'when perform_later is called' do
let(:custom_queue) { 'low' }
it 'enqueues email is custom queue for low priority delivery' do
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
end
end

View file

@ -151,8 +151,8 @@ RSpec.describe UserMailer, type: :mailer do
context 'when perform_later is called' do
let(:role) { administrateurs(:default_admin) }
let(:custom_queue) { 'low' }
it 'enqueues email is custom queue for low priority delivery' do
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
end
end
@ -167,8 +167,8 @@ RSpec.describe UserMailer, type: :mailer do
end
context 'when perform_later is called' do
let(:custom_queue) { 'low' }
it 'enqueues email is custom queue for low priority delivery' do
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
end
end
@ -181,13 +181,13 @@ RSpec.describe UserMailer, type: :mailer do
it 'notifies user about procedure closing with detailed message' do
expect(subject.to).to eq([user.email])
expect(subject.body).to include("Clôture d&#39;une démarche sur demarches-simplifiees.fr")
expect(subject.body).to include("Clôture d&#39;une démarche sur #{APPLICATION_NAME}")
expect(subject.body).to include("Bonjour,\r\n<br />saut de ligne")
end
context 'when perform_later is called' do
let(:custom_queue) { 'low' }
it 'enqueues email is custom queue for low priority delivery' do
let(:custom_queue) { 'default' }
it 'enqueues email is custom queue for non critical delivery' do
expect { subject.deliver_later }.to have_enqueued_job.on_queue(custom_queue)
end
end