Merge branch 'dev'

This commit is contained in:
gregoirenovel 2018-05-30 16:56:28 +02:00
commit e47c3a46ad
5 changed files with 27 additions and 6 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

@ -51,7 +51,8 @@
= "#{c.libelle} :"
%td.rich-text
%span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) }
= render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { etablissement: c.etablissement }
- if c.etablissement.present?
= render partial: "new_gestionnaire/dossiers/identite_entreprise", locals: { etablissement: c.etablissement }
- else
%th.libelle
= "#{c.libelle} :"

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