From 01da457ad0f03b6f192584adff3d8ccc47b165ca Mon Sep 17 00:00:00 2001 From: Simon Lehericey Date: Mon, 25 Sep 2017 18:06:20 +0200 Subject: [PATCH] DossierController: a dossier commented is followed --- app/controllers/new_gestionnaire/dossiers_controller.rb | 1 + spec/controllers/new_gestionnaire/dossiers_controller_spec.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/app/controllers/new_gestionnaire/dossiers_controller.rb b/app/controllers/new_gestionnaire/dossiers_controller.rb index 8bd5cac96..33dc030b7 100644 --- a/app/controllers/new_gestionnaire/dossiers_controller.rb +++ b/app/controllers/new_gestionnaire/dossiers_controller.rb @@ -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 diff --git a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb index 6610ae4c9..750fe3e73 100644 --- a/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb +++ b/spec/controllers/new_gestionnaire/dossiers_controller_spec.rb @@ -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