From ed8b4ff083d1b2f9ac4b27108fbf31895086f071 Mon Sep 17 00:00:00 2001 From: Xavier J Date: Thu, 17 Dec 2015 10:06:40 +0100 Subject: [PATCH] Add mailer submitted dossier. --- app/mailers/notification_mailer.rb | 4 ++++ .../notification_mailer/dossier_submitted.text.erb | 8 ++++++++ .../notification_mailer/dossier_validated.text.erb | 2 +- app/views/notification_mailer/new_answer.text.erb | 2 +- spec/mailers/notification_mailer_spec.rb | 12 ++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 app/views/notification_mailer/dossier_submitted.text.erb diff --git a/app/mailers/notification_mailer.rb b/app/mailers/notification_mailer.rb index 7f5fb7243..eb609268b 100644 --- a/app/mailers/notification_mailer.rb +++ b/app/mailers/notification_mailer.rb @@ -7,6 +7,10 @@ class NotificationMailer < ApplicationMailer send_mail dossier, "Votre dossier TPS N°#{dossier.id} a été validé" end + def dossier_submitted dossier + send_mail dossier, "Votre dossier TPS N°#{dossier.id} a été déposé" + end + private def vars_mailer dossier diff --git a/app/views/notification_mailer/dossier_submitted.text.erb b/app/views/notification_mailer/dossier_submitted.text.erb new file mode 100644 index 000000000..ced433b16 --- /dev/null +++ b/app/views/notification_mailer/dossier_submitted.text.erb @@ -0,0 +1,8 @@ +Bonjour <%= @user.email %> + +Nous vous confirmons que votre dossier N°<%=@dossier.id%> a été déposé aurpès de <%= @dossier.procedure.organisation %> avec succès ce jour à <%= @dossier.updated_at %>. + +Bonne journée + +--- +L'équide TPS - tps@apientreprise.fr \ No newline at end of file diff --git a/app/views/notification_mailer/dossier_validated.text.erb b/app/views/notification_mailer/dossier_validated.text.erb index d53e46c87..f2a555ac4 100644 --- a/app/views/notification_mailer/dossier_validated.text.erb +++ b/app/views/notification_mailer/dossier_validated.text.erb @@ -1,4 +1,4 @@ -Bonjour <%= @user.email %>! +Bonjour <%= @user.email %> Votre dossier N°<%=@dossier.id%> a été validé par votre accompagnateur. diff --git a/app/views/notification_mailer/new_answer.text.erb b/app/views/notification_mailer/new_answer.text.erb index 85fa66ee7..947d7826d 100644 --- a/app/views/notification_mailer/new_answer.text.erb +++ b/app/views/notification_mailer/new_answer.text.erb @@ -1,4 +1,4 @@ -Bonjour <%= @user.email %>! +Bonjour <%= @user.email %> Un nouveau commentaire est disponible dans votre espace TPS. diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb index 779923ba9..deed3f916 100644 --- a/spec/mailers/notification_mailer_spec.rb +++ b/spec/mailers/notification_mailer_spec.rb @@ -22,4 +22,16 @@ RSpec.describe NotificationMailer, type: :mailer do it { expect(subject.body).to include("Afin de finaliser son dépot, merci de vous rendre sur #{users_dossier_recapitulatif_url(dossier_id: dossier.id)}") } it { expect(subject.subject).to eq("Votre dossier TPS N°#{dossier.id} a été validé") } end + + describe ".dossier_submitted" do + let(:user) { create(:user) } + let(:dossier) { create(:dossier, :with_procedure, user: user) } + + subject(:subject) { described_class.dossier_submitted(dossier) } + + it { expect(subject.body).to match("Nous vous confirmons que votre dossier N°#{dossier.id} a été déposé") } + it { expect(subject.body).to match("aurpès de #{dossier.procedure.organisation} avec succès") } + it { expect(subject.body).to match("ce jour à #{dossier.updated_at}.") } + it { expect(subject.subject).to eq("Votre dossier TPS N°#{dossier.id} a été déposé") } + end end