DossierController: a dossier commented is followed

This commit is contained in:
Simon Lehericey 2017-09-25 18:06:20 +02:00
parent 9904fa79a4
commit 01da457ad0
2 changed files with 2 additions and 0 deletions

View file

@ -50,6 +50,7 @@ module NewGestionnaire
def create_commentaire
Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier))
current_gestionnaire.follow(dossier)
flash.notice = "Message envoyé"
redirect_to messagerie_dossier_path(dossier.procedure, dossier)
end

View file

@ -121,6 +121,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
it { expect(saved_commentaire.email).to eq(gestionnaire.email) }
it { expect(saved_commentaire.dossier).to eq(dossier) }
it { expect(response).to redirect_to(messagerie_dossier_path(dossier.procedure, dossier)) }
it { expect(gestionnaire.followed_dossiers).to include(dossier) }
end
describe "#create_avis" do