DossierController: use the new method send_notification

This commit is contained in:
Simon Lehericey 2017-03-05 22:14:21 +01:00
parent 65d399b4b0
commit 36500407b4
2 changed files with 6 additions and 3 deletions

View file

@ -88,10 +88,12 @@ class Backoffice::DossiersController < Backoffice::DossiersListController
def receive
create_dossier_facade params[:dossier_id]
@facade.dossier.received!
dossier = @facade.dossier
dossier.received!
flash.notice = 'Dossier considéré comme reçu.'
NotificationMailer.dossier_received(@facade.dossier).deliver_now!
NotificationMailer.send_notification(dossier, dossier.procedure.initiated_mail).deliver_now!
redirect_to backoffice_dossier_path(id: @facade.dossier.id)
end

View file

@ -236,7 +236,8 @@ describe Backoffice::DossiersController, type: :controller do
end
it 'Notification email is send' do
expect(NotificationMailer).to receive(:dossier_received).and_return(NotificationMailer)
expect(NotificationMailer).to receive(:send_notification)
.with(dossier, kind_of(InitiatedMail)).and_return(NotificationMailer)
expect(NotificationMailer).to receive(:deliver_now!)
subject