Send email when gestionnaire valide a dossier
This commit is contained in:
parent
a24ff681fc
commit
b237d7c890
2 changed files with 12 additions and 1 deletions
|
@ -52,6 +52,8 @@ class Backoffice::DossiersController < ApplicationController
|
|||
@dossier.next_step! 'gestionnaire', 'valid'
|
||||
flash.notice = 'Dossier confirmé avec succès.'
|
||||
|
||||
NotificationMailer.dossier_validated(@dossier).deliver_now!
|
||||
|
||||
render 'show'
|
||||
end
|
||||
|
||||
|
|
|
@ -98,12 +98,21 @@ describe Backoffice::DossiersController, type: :controller do
|
|||
sign_in gestionnaire
|
||||
end
|
||||
|
||||
subject { post :valid, dossier_id: dossier_id }
|
||||
|
||||
it 'change state to validated' do
|
||||
post :valid, dossier_id: dossier_id
|
||||
subject
|
||||
|
||||
dossier.reload
|
||||
expect(dossier.state).to eq('validated')
|
||||
end
|
||||
|
||||
it 'Notification email is send' do
|
||||
expect(NotificationMailer).to receive(:dossier_validated).and_return(NotificationMailer)
|
||||
expect(NotificationMailer).to receive(:deliver_now!)
|
||||
|
||||
subject
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST #close' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue