Merge pull request #2360 from betagouv/fix-brouillon-email-url

[Email] Correction de l'URL vers le brouillon nouvellement créé
This commit is contained in:
Pierre de La Morinerie 2018-08-08 15:31:32 +02:00 committed by GitHub
commit 1edb13caf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -5,7 +5,7 @@
Vous pouvez retrouver et compléter le brouillon que vous avez créé pour la démarche
%strong= @dossier.procedure.libelle
à l'adresse suivante :
= link_to users_dossiers_url(liste: 'brouillon'), users_dossiers_url(liste: 'brouillon'), target: '_blank'
= link_to dossier_url(@dossier), dossier_url(@dossier), target: '_blank'
%p
Bonne journée,

View file

@ -556,6 +556,8 @@ describe Dossier do
end
describe "#send_draft_notification_email" do
include Rails.application.routes.url_helpers
let(:procedure) { create(:procedure) }
let(:user) { create(:user) }
@ -564,15 +566,17 @@ describe Dossier do
end
it "send an email when the dossier is created for the very first time" do
dossier = nil
ActiveJob::Base.queue_adapter = :test
expect do
perform_enqueued_jobs do
Dossier.create(procedure: procedure, state: "brouillon", user: user)
dossier = Dossier.create(procedure: procedure, state: "brouillon", user: user)
end
end.to change(ActionMailer::Base.deliveries, :size).from(0).to(1)
mail = ActionMailer::Base.deliveries.last
expect(mail.subject).to eq("Retrouvez votre brouillon pour la démarche \"#{procedure.libelle}\"")
expect(mail.html_part.body).to include(dossier_url(dossier))
end
it "does not send an email when the dossier is created with a non brouillon state" do