DossierController: a dossier commented is followed
This commit is contained in:
parent
9904fa79a4
commit
01da457ad0
2 changed files with 2 additions and 0 deletions
|
@ -50,6 +50,7 @@ module NewGestionnaire
|
||||||
|
|
||||||
def create_commentaire
|
def create_commentaire
|
||||||
Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier))
|
Commentaire.create(commentaire_params.merge(email: current_gestionnaire.email, dossier: dossier))
|
||||||
|
current_gestionnaire.follow(dossier)
|
||||||
flash.notice = "Message envoyé"
|
flash.notice = "Message envoyé"
|
||||||
redirect_to messagerie_dossier_path(dossier.procedure, dossier)
|
redirect_to messagerie_dossier_path(dossier.procedure, dossier)
|
||||||
end
|
end
|
||||||
|
|
|
@ -121,6 +121,7 @@ describe NewGestionnaire::DossiersController, type: :controller do
|
||||||
it { expect(saved_commentaire.email).to eq(gestionnaire.email) }
|
it { expect(saved_commentaire.email).to eq(gestionnaire.email) }
|
||||||
it { expect(saved_commentaire.dossier).to eq(dossier) }
|
it { expect(saved_commentaire.dossier).to eq(dossier) }
|
||||||
it { expect(response).to redirect_to(messagerie_dossier_path(dossier.procedure, dossier)) }
|
it { expect(response).to redirect_to(messagerie_dossier_path(dossier.procedure, dossier)) }
|
||||||
|
it { expect(gestionnaire.followed_dossiers).to include(dossier) }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#create_avis" do
|
describe "#create_avis" do
|
||||||
|
|
Loading…
Reference in a new issue