diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 31eb93b03..020b5ff38 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -874,6 +874,7 @@ class Dossier < ApplicationRecord .passer_en_construction .processed_at save! + procedure.compute_dossiers_count end def after_passer_en_instruction(h) diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index ca87290b1..3442c61d9 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -2080,6 +2080,15 @@ describe Dossier do end end + describe 'update procedure dossiers count' do + let(:dossier) { create(:dossier, :brouillon, :with_individual) } + + it 'update procedure dossiers count when passing to construction' do + expect(dossier.procedure).to receive(:compute_dossiers_count) + dossier.passer_en_construction! + end + end + private def count_for_month(processed_by_month, month)