dossier: send deletion email also to the following gestionnaires
This commit is contained in:
parent
6daa31d410
commit
13182ad291
2 changed files with 27 additions and 3 deletions
|
@ -828,9 +828,29 @@ describe Dossier do
|
|||
expect(deleted_dossier.deleted_at).to be_present
|
||||
end
|
||||
|
||||
it 'sends notification emails' do
|
||||
it 'notifies the user' do
|
||||
expect(DossierMailer).to have_received(:notify_deletion_to_user).with(deleted_dossier, dossier.user.email)
|
||||
expect(DossierMailer).to have_received(:notify_deletion_to_administration).with(deleted_dossier, dossier.procedure.administrateur.email)
|
||||
end
|
||||
|
||||
context 'where gestionnaires are following the dossier' do
|
||||
let(:dossier) { create(:dossier, :followed) }
|
||||
let!(:non_following_gestionnaire) do
|
||||
non_following_gestionnaire = create(:gestionnaire)
|
||||
non_following_gestionnaire.procedures << dossier.procedure
|
||||
non_following_gestionnaire
|
||||
end
|
||||
|
||||
it 'notifies the following gestionnaires' do
|
||||
expect(DossierMailer).to have_received(:notify_deletion_to_administration).once
|
||||
expect(DossierMailer).to have_received(:notify_deletion_to_administration).with(deleted_dossier, dossier.followers_gestionnaires.first.email)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when there are no following gestionnaires' do
|
||||
it 'notifies the procedure administrateur' do
|
||||
expect(DossierMailer).to have_received(:notify_deletion_to_administration).once
|
||||
expect(DossierMailer).to have_received(:notify_deletion_to_administration).with(deleted_dossier, dossier.procedure.administrateur.email)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue