No dubious proc. email == Everything is ok || Something went wrong. We should always send dubious procedure email.
This commit is contained in:
parent
9f8083f69c
commit
7f4e6eae6b
3 changed files with 15 additions and 12 deletions
|
@ -24,8 +24,6 @@ class FindDubiousProceduresJob < ApplicationJob
|
||||||
.group_by(&:procedure_id)
|
.group_by(&:procedure_id)
|
||||||
.map { |_procedure_id, tdcs| [tdcs[0].procedure, tdcs] }
|
.map { |_procedure_id, tdcs| [tdcs[0].procedure, tdcs] }
|
||||||
|
|
||||||
if dubious_procedures_and_tdcs.present?
|
AdministrationMailer.dubious_procedures(dubious_procedures_and_tdcs).deliver_now
|
||||||
AdministrationMailer.dubious_procedures(dubious_procedures_and_tdcs).deliver_now
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
- content_for(:title, 'Liste de procédures douteuses')
|
- content_for(:title, 'Liste de procédures douteuses')
|
||||||
|
|
||||||
%ul
|
- if @procedures_and_type_de_champs.any?
|
||||||
- @procedures_and_type_de_champs.each do |procedure, type_de_champs|
|
%ul
|
||||||
%li
|
- @procedures_and_type_de_champs.each do |procedure, type_de_champs|
|
||||||
= link_to "Nº #{procedure.id},", manager_procedure_url(procedure)
|
%li
|
||||||
#{procedure.libelle} :
|
= link_to "Nº #{procedure.id},", manager_procedure_url(procedure)
|
||||||
%b= type_de_champs.map(&:libelle).join(', ')
|
#{procedure.libelle} :
|
||||||
|
%b= type_de_champs.map(&:libelle).join(', ')
|
||||||
|
- else
|
||||||
|
Il n'y a aucune procédure douteuse aujourd'hui
|
||||||
|
|
|
@ -30,25 +30,27 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
|
||||||
|
|
||||||
expect(receive_procedure).to eq(procedure)
|
expect(receive_procedure).to eq(procedure)
|
||||||
expect(receive_forbidden_tdcs).to match(forbidden_tdcs)
|
expect(receive_forbidden_tdcs).to match(forbidden_tdcs)
|
||||||
|
|
||||||
|
expect(AdministrationMailer).to have_received(:dubious_procedures).with(@dubious_procedures_args)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and a whitelisted procedure' do
|
context 'and a whitelisted procedure' do
|
||||||
let(:procedure) { create(:procedure, whitelisted_at: DateTime.now) }
|
let(:procedure) { create(:procedure, whitelisted_at: DateTime.now) }
|
||||||
|
|
||||||
it { expect(AdministrationMailer).not_to have_received(:dubious_procedures) }
|
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'and a archived procedure' do
|
context 'and a archived procedure' do
|
||||||
let(:procedure) { create(:procedure, archived_at: DateTime.now) }
|
let(:procedure) { create(:procedure, archived_at: DateTime.now) }
|
||||||
|
|
||||||
it { expect(AdministrationMailer).not_to have_received(:dubious_procedures) }
|
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with no suspicious champs' do
|
context 'with no suspicious champs' do
|
||||||
let(:tdcs) { [allowed_tdc] }
|
let(:tdcs) { [allowed_tdc] }
|
||||||
|
|
||||||
it { expect(AdministrationMailer).not_to receive(:dubious_procedures) }
|
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue