Merge pull request #1971 from betagouv/fix_1952_improve_dubious_procedure

Fix 1952 improve dubious procedure
This commit is contained in:
Paul Chavard 2018-05-30 14:40:40 +02:00 committed by GitHub
commit 6303372b3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 5 deletions

View file

@ -2,8 +2,9 @@ class FindDubiousProceduresJob < ApplicationJob
queue_as :cron
FORBIDDEN_KEYWORDS = [
'IBAN', 'NIR', 'NIRPP', 'race', 'religion',
'carte bancaire', 'carte bleue', 'sécurité sociale'
'NIR', 'NIRPP', 'race', 'religion',
'carte bancaire', 'carte bleue', 'sécurité sociale', 'nationalité',
'agdref', 'handicap', 'syndicat', 'politique'
]
def perform(*args)

View file

@ -3,9 +3,16 @@
- if @procedures_and_type_de_champs.any?
%ul
- @procedures_and_type_de_champs.each do |procedure, type_de_champs|
%li
%li{ style: 'margin-bottom: 8px;' }
= link_to "Nº #{procedure.id},", manager_procedure_url(procedure)
 #{procedure.libelle} :
%b= type_de_champs.map(&:libelle).join(', ')
%br
État : #{procedure.aasm_state}
%br
Nombre de dossier : #{procedure.dossiers.count}
%br
Admin :
= link_to "#{procedure.administrateur.email}", "mailto:#{procedure.administrateur.email}"
- else
Il n'y a aucune procédure douteuse aujourd'hui

View file

@ -119,6 +119,12 @@ FactoryBot.define do
end
end
trait :whitelisted do
after(:build) do |procedure, _evaluator|
procedure.update(whitelisted_at: DateTime.now)
end
end
trait :with_notice do
after(:create) do |procedure, _evaluator|
procedure.notice.attach(

View file

@ -35,13 +35,19 @@ RSpec.describe FindDubiousProceduresJob, type: :job do
end
context 'and a whitelisted procedure' do
let(:procedure) { create(:procedure, whitelisted_at: DateTime.now) }
let(:procedure) { create(:procedure, :whitelisted) }
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end
context 'and a archived procedure' do
let(:procedure) { create(:procedure, archived_at: DateTime.now) }
let(:procedure) { create(:procedure, :archived) }
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end
context 'and a hidden procedure' do
let(:procedure) { create(:procedure, :hidden) }
it { expect(AdministrationMailer).to have_received(:dubious_procedures).with([]) }
end