Skip to content

Commit

Permalink
fix(job): non crirtical mail must be sent into < 15min, not hours
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Oct 10, 2024
1 parent da5de8d commit 7f18db6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion app/jobs/priorized_mail_delivery_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ def queue_name
end

def custom_queue
'low'
'default'
end
end
8 changes: 4 additions & 4 deletions spec/mailers/administrateur_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
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
Expand Down Expand Up @@ -51,8 +51,8 @@
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
Expand Down
8 changes: 4 additions & 4 deletions spec/mailers/instructeur_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
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
Expand Down Expand Up @@ -80,8 +80,8 @@
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
Expand Down
14 changes: 7 additions & 7 deletions spec/mailers/user_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@

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
Expand All @@ -167,8 +167,8 @@
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
Expand All @@ -181,13 +181,13 @@

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
Expand Down

0 comments on commit 7f18db6

Please sign in to comment.