From 1d99e21a27b10d2d1ab1cb3a8e157439ecd0c4e2 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 4 Apr 2022 15:29:38 +0200 Subject: [PATCH] tech(bug): identify --- .../instructeurs/procedures_controller_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/controllers/instructeurs/procedures_controller_spec.rb b/spec/controllers/instructeurs/procedures_controller_spec.rb index 04d0f85c2..e73ae4b1a 100644 --- a/spec/controllers/instructeurs/procedures_controller_spec.rb +++ b/spec/controllers/instructeurs/procedures_controller_spec.rb @@ -155,6 +155,23 @@ describe Instructeurs::ProceduresController, type: :controller do it { expect(assigns(:all_dossiers_counts)['archivés']).to eq(1 + 0) } it { expect(assigns(:all_dossiers_counts)['expirant']).to eq(2 + 0) } end + + context 'with not draft state on discarded procedure' do + let(:discarded_procedure) { create(:procedure, :discarded, :expirable) } + let(:state) { Dossier.states.fetch(:en_construction) } + before do + create(:dossier, procedure: discarded_procedure, state: Dossier.states.fetch(:en_construction)) + instructeur.groupe_instructeurs << discarded_procedure.defaut_groupe_instructeur + subject + end + + it { expect(assigns(:dossiers_count_per_procedure)[procedure.id]).to eq(1) } + it { expect(assigns(:dossiers_a_suivre_count_per_procedure)[procedure.id]).to eq(1) } + + it { expect(assigns(:dossiers_count_per_procedure)[discarded_procedure.id]).to be_nil } + + it { expect(assigns(:all_dossiers_counts)['à suivre']).to eq(1) } + end end context "with a routed procedure" do