From a3442674f940087d3e3c6ddaf41a4af25c49c428 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 9 Jul 2018 17:11:59 +0200 Subject: [PATCH 1/4] apercu: fix typo --- app/views/new_administrateur/procedures/apercu.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_administrateur/procedures/apercu.html.haml b/app/views/new_administrateur/procedures/apercu.html.haml index 5e9d1732d..edc6b0fc5 100644 --- a/app/views/new_administrateur/procedures/apercu.html.haml +++ b/app/views/new_administrateur/procedures/apercu.html.haml @@ -9,7 +9,7 @@ - if @dossier.champs_private.size > 0 %li{ class: (@tab == 'annotations-privees') ? 'active' : nil }> = link_to(apercu_procedure_path(@dossier.procedure, tab: 'annotations-privees')) do - les annotations privees + les annotations privées - if @tab == 'dossier' = render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: true } From 540c744912f8bdb3566306823285d8081f6ae28d Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Thu, 12 Jul 2018 11:03:18 +0200 Subject: [PATCH 2/4] apercu: add quotes around the procedure name --- app/views/new_administrateur/procedures/apercu.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/new_administrateur/procedures/apercu.html.haml b/app/views/new_administrateur/procedures/apercu.html.haml index edc6b0fc5..aa682ade8 100644 --- a/app/views/new_administrateur/procedures/apercu.html.haml +++ b/app/views/new_administrateur/procedures/apercu.html.haml @@ -1,6 +1,6 @@ .dossiers-headers.sub-header .container - %h1.page-title Prévisualisation de la procédure #{@dossier.procedure.libelle} + %h1.page-title Prévisualisation de la procédure « #{@dossier.procedure.libelle} » %ul.tabs %li{ class: (@tab == 'dossier') ? 'active' : nil }> From d6624aeca7cffb88dd1efcaf0ad32822e2fbeaca Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 16 Jul 2018 14:39:04 +0200 Subject: [PATCH 3/4] mailers: add tests for dossier_mailer --- spec/factories/deleted_dossier.rb | 9 ++++++++ spec/mailers/dossier_mailer_spec.rb | 36 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 spec/factories/deleted_dossier.rb create mode 100644 spec/mailers/dossier_mailer_spec.rb diff --git a/spec/factories/deleted_dossier.rb b/spec/factories/deleted_dossier.rb new file mode 100644 index 000000000..5713fbf59 --- /dev/null +++ b/spec/factories/deleted_dossier.rb @@ -0,0 +1,9 @@ +FactoryBot.define do + factory :deleted_dossier do + dossier_id 1111 + state 'en_construction' + deleted_at DateTime.now + + association :procedure, :published + end +end diff --git a/spec/mailers/dossier_mailer_spec.rb b/spec/mailers/dossier_mailer_spec.rb new file mode 100644 index 000000000..573ba1eac --- /dev/null +++ b/spec/mailers/dossier_mailer_spec.rb @@ -0,0 +1,36 @@ +require "rails_helper" + +RSpec.describe DossierMailer, type: :mailer do + let(:to_email) { 'gestionnaire@exemple.gouv.fr' } + + describe '.notify_deletion_to_user' do + let(:deleted_dossier) { build(:deleted_dossier) } + + subject { described_class.notify_deletion_to_user(deleted_dossier, to_email) } + + it { expect(subject.subject).to eq("Votre dossier n° #{deleted_dossier.dossier_id} a bien été supprimé") } + it { expect(subject.body).to include("Votre dossier") } + it { expect(subject.body).to include(deleted_dossier.dossier_id) } + it { expect(subject.body).to include("a bien été supprimé") } + end + + describe '.notify_deletion_to_administration' do + let(:deleted_dossier) { build(:deleted_dossier) } + + subject { described_class.notify_deletion_to_administration(deleted_dossier, to_email) } + + it { expect(subject.subject).to eq("Le dossier n° #{deleted_dossier.dossier_id} a été supprimé à la demande de l'usager") } + it { expect(subject.body).to include("À la demande de l'usager") } + it { expect(subject.body).to include(deleted_dossier.dossier_id) } + end + + describe '.notify_unhide_to_user' do + let(:dossier) { create(:dossier) } + + subject { described_class.notify_unhide_to_user(dossier) } + + it { expect(subject.subject).to eq("Votre dossier n° #{dossier.id} n'a pas pu être supprimé") } + it { expect(subject.body).to include(dossier.id) } + it { expect(subject.body).to include("n'a pas pu être supprimé") } + end +end From 40aae2e20b666c7883c9877494aa50d82abd2264 Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Mon, 16 Jul 2018 13:38:03 +0000 Subject: [PATCH 4/4] mailers: mention the procedure when notifying about dossier deletion --- .../notify_deletion_to_administration.html.haml | 4 +++- app/views/dossier_mailer/notify_deletion_to_user.html.haml | 3 ++- app/views/dossier_mailer/notify_unhide_to_user.html.haml | 3 ++- spec/mailers/dossier_mailer_spec.rb | 3 +++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/views/dossier_mailer/notify_deletion_to_administration.html.haml b/app/views/dossier_mailer/notify_deletion_to_administration.html.haml index d187708cf..e2a5fd25f 100644 --- a/app/views/dossier_mailer/notify_deletion_to_administration.html.haml +++ b/app/views/dossier_mailer/notify_deletion_to_administration.html.haml @@ -3,7 +3,9 @@ %h1 Bonjour, %p - À la demande de l'usager le dossier n° #{@deleted_dossier.dossier_id} a été supprimé. + À la demande de l'usager, le dossier n° #{@deleted_dossier.dossier_id} + (sur la démarche « #{@deleted_dossier.procedure.libelle} ») + a été supprimé. %p Bonne journée, diff --git a/app/views/dossier_mailer/notify_deletion_to_user.html.haml b/app/views/dossier_mailer/notify_deletion_to_user.html.haml index de9882264..d8031aca6 100644 --- a/app/views/dossier_mailer/notify_deletion_to_user.html.haml +++ b/app/views/dossier_mailer/notify_deletion_to_user.html.haml @@ -3,7 +3,8 @@ %h1 Bonjour, %p - Votre dossier n° #{@deleted_dossier.dossier_id} a bien été supprimé. + Votre dossier n° #{@deleted_dossier.dossier_id} + (« #{@deleted_dossier.procedure.libelle} ») a bien été supprimé. Une trace anonyme de ce traitement sera conservée pour l’administration. %p diff --git a/app/views/dossier_mailer/notify_unhide_to_user.html.haml b/app/views/dossier_mailer/notify_unhide_to_user.html.haml index 6901a01e3..e95e976e2 100644 --- a/app/views/dossier_mailer/notify_unhide_to_user.html.haml +++ b/app/views/dossier_mailer/notify_unhide_to_user.html.haml @@ -3,7 +3,8 @@ %h1 Bonjour, %p - L'instruction de votre dossier n° #{@dossier.id} ayant commencé, il n'a pas pu être supprimé. + L'instruction de votre dossier n° #{@dossier.id} (« #{@dossier.procedure.libelle} ») + ayant commencé, il n'a pas pu être supprimé. Le dossier a été rétabli dans votre tableau de bord. %p diff --git a/spec/mailers/dossier_mailer_spec.rb b/spec/mailers/dossier_mailer_spec.rb index 573ba1eac..3ef6b018f 100644 --- a/spec/mailers/dossier_mailer_spec.rb +++ b/spec/mailers/dossier_mailer_spec.rb @@ -12,6 +12,7 @@ RSpec.describe DossierMailer, type: :mailer do it { expect(subject.body).to include("Votre dossier") } it { expect(subject.body).to include(deleted_dossier.dossier_id) } it { expect(subject.body).to include("a bien été supprimé") } + it { expect(subject.body).to include(deleted_dossier.procedure.libelle) } end describe '.notify_deletion_to_administration' do @@ -22,6 +23,7 @@ RSpec.describe DossierMailer, type: :mailer do it { expect(subject.subject).to eq("Le dossier n° #{deleted_dossier.dossier_id} a été supprimé à la demande de l'usager") } it { expect(subject.body).to include("À la demande de l'usager") } it { expect(subject.body).to include(deleted_dossier.dossier_id) } + it { expect(subject.body).to include(deleted_dossier.procedure.libelle) } end describe '.notify_unhide_to_user' do @@ -32,5 +34,6 @@ RSpec.describe DossierMailer, type: :mailer do it { expect(subject.subject).to eq("Votre dossier n° #{dossier.id} n'a pas pu être supprimé") } it { expect(subject.body).to include(dossier.id) } it { expect(subject.body).to include("n'a pas pu être supprimé") } + it { expect(subject.body).to include(dossier.procedure.libelle) } end end