From 4bfcf4f9d9c4e03c2994bafa1143b78df32a25cf Mon Sep 17 00:00:00 2001 From: Kara Diaby Date: Thu, 17 Mar 2022 11:21:45 +0100 Subject: [PATCH] tests --- .../instructeurs/dossiers_controller_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/controllers/instructeurs/dossiers_controller_spec.rb b/spec/controllers/instructeurs/dossiers_controller_spec.rb index b5cd1e38c..e8a2a838e 100644 --- a/spec/controllers/instructeurs/dossiers_controller_spec.rb +++ b/spec/controllers/instructeurs/dossiers_controller_spec.rb @@ -457,6 +457,20 @@ describe Instructeurs::DossiersController, type: :controller do expect(flash.notice).to be_present end end + + context "when the dossier is deleted by user" do + let(:dossier) { create(:dossier, :accepte, procedure: procedure) } + + before do + dossier.update!(hidden_by_user_at: 1.hour.ago) + subject + end + + it "does not create a commentaire" do + expect { subject }.to change(Commentaire, :count).by(0) + expect(flash.alert).to be_present + end + end end describe "#create_avis" do