diff --git a/.gitignore b/.gitignore index 96f49c920..9a9dd9ca4 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ storage/ yarn-debug.log* .yarn-integrity /.vscode +/.idea /public/packs /public/packs-test /node_modules diff --git a/README.md b/README.md index 39f802e98..ed501dad8 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Vous souhaitez y apporter des changements ou des améliorations ? Lisez notre [ - Chrome - chromedriver : - * Mac : `brew install chromedriver` + * Mac : `brew cask install chromedriver` * Linux : voir https://sites.google.com/a/chromium.org/chromedriver/downloads ### Création des rôles de la base de données diff --git a/app/mailers/gestionnaire_mailer.rb b/app/mailers/gestionnaire_mailer.rb index 472f09dae..7607e37ac 100644 --- a/app/mailers/gestionnaire_mailer.rb +++ b/app/mailers/gestionnaire_mailer.rb @@ -21,11 +21,13 @@ class GestionnaireMailer < ApplicationMailer def last_week_overview(gestionnaire) email = gestionnaire.email - @overview = gestionnaire.last_week_overview - headers['X-mailjet-campaign'] = 'last_week_overview' @subject = 'Votre activité hebdomadaire' + @overview = gestionnaire.last_week_overview - mail(to: email, subject: @subject) + if @overview.present? + headers['X-mailjet-campaign'] = 'last_week_overview' + mail(to: email, subject: @subject) + end end def send_dossier(sender, dossier, recipient) diff --git a/app/views/admin/procedures/show.html.haml b/app/views/admin/procedures/show.html.haml index 65828af5b..84a5a260e 100644 --- a/app/views/admin/procedures/show.html.haml +++ b/app/views/admin/procedures/show.html.haml @@ -65,7 +65,7 @@ pour y accéder vous pouvez utiliser le lien : = link_to procedure_lien(@procedure), sanitize_url(procedure_lien(@procedure)), target: :blank, rel: :noopener %p - Tout personne ayant la connaissance de ce lien pourra ainsi remplir des dossiers de test sur votre démarche. + Toute personne ayant la connaissance de ce lien pourra ainsi remplir des dossiers de test sur votre démarche. %br %h4 Ce que vous pouvez faire lorsque vous êtes en test diff --git a/app/views/shared/dossiers/editable_champs/_textarea.html.haml b/app/views/shared/dossiers/editable_champs/_textarea.html.haml index c1bac654c..620f11c6d 100644 --- a/app/views/shared/dossiers/editable_champs/_textarea.html.haml +++ b/app/views/shared/dossiers/editable_champs/_textarea.html.haml @@ -1,5 +1,4 @@ ~ form.text_area :value, row: 6, - placeholder: champ.description, required: champ.mandatory?, value: html_to_string(champ.value) diff --git a/spec/mailers/gestionnaire_mailer_spec.rb b/spec/mailers/gestionnaire_mailer_spec.rb index 40f4ea2a4..20e3c670c 100644 --- a/spec/mailers/gestionnaire_mailer_spec.rb +++ b/spec/mailers/gestionnaire_mailer_spec.rb @@ -35,5 +35,15 @@ RSpec.describe GestionnaireMailer, type: :mailer do subject { described_class.last_week_overview(gestionnaire) } it { expect(subject.body).to include('Votre activité hebdomadaire') } + + context 'when the gestionnaire has no active procedures' do + let(:procedure) { nil } + let(:last_week_overview) { nil } + + it 'doesn’t send the email' do + expect(subject.message).to be_kind_of(ActionMailer::Base::NullMail) + expect(subject.body).to be_blank + end + end end end diff --git a/spec/models/procedure_spec.rb b/spec/models/procedure_spec.rb index 1a26b4704..7337b1cf5 100644 --- a/spec/models/procedure_spec.rb +++ b/spec/models/procedure_spec.rb @@ -754,13 +754,13 @@ describe Procedure do let!(:old_dossier) { create_dossier(construction_date: 3.months.ago, instruction_date: 2.months.ago) } it 'ignores dossiers older than 1 month' do - expect(procedure.usual_verification_time).to be_within(10.seconds).of(2.days) + expect(procedure.usual_verification_time).to be_within(1.hour).of(2.days) end end context 'when there is only one dossier in the time frame' do let(:delays) { [1.day] } - it { expect(procedure.usual_verification_time).to be_within(10.seconds).of(1.day) } + it { expect(procedure.usual_verification_time).to be_within(1.hour).of(1.day) } end context 'where there are no dossiers' do @@ -796,7 +796,7 @@ describe Procedure do let!(:old_dossier) { create_dossier(instruction_date: 3.months.ago, processed_date: 2.months.ago) } it 'ignores dossiers older than 1 month' do - expect(procedure.usual_instruction_time).to be_within(10.seconds).of(2.days) + expect(procedure.usual_instruction_time).to be_within(1.hour).of(2.days) end end @@ -805,13 +805,13 @@ describe Procedure do let!(:bad_dossier) { create_dossier(instruction_date: nil, processed_date: 10.days.ago) } it 'ignores bad dossiers' do - expect(procedure.usual_instruction_time).to be_within(10.seconds).of(2.days) + expect(procedure.usual_instruction_time).to be_within(1.hour).of(2.days) end end context 'when there is only one processed dossier' do let(:delays) { [1.day] } - it { expect(procedure.usual_instruction_time).to be_within(10.seconds).of(1.day) } + it { expect(procedure.usual_instruction_time).to be_within(1.hour).of(1.day) } end context 'where there is no processed dossier' do