feat(instructeur): pending correction blocks passer en instruction
Closes #9731
This commit is contained in:
parent
ecc3638d81
commit
c26b59722d
9 changed files with 60 additions and 18 deletions
|
@ -1148,7 +1148,6 @@ describe Dossier, type: :model do
|
|||
let(:last_operation) { dossier.dossier_operation_logs.last }
|
||||
let(:operation_serialized) { last_operation.data }
|
||||
let(:instructeur) { create(:instructeur) }
|
||||
let!(:correction) { create(:dossier_correction, dossier:) } # correction has a commentaire
|
||||
|
||||
subject(:passer_en_instruction) { dossier.passer_en_instruction!(instructeur: instructeur) }
|
||||
|
||||
|
@ -1167,13 +1166,6 @@ describe Dossier, type: :model do
|
|||
|
||||
it { expect { passer_en_instruction }.to change { dossier.commentaires.count }.by(1) }
|
||||
|
||||
it "resolve pending correction" do
|
||||
passer_en_instruction
|
||||
|
||||
expect(dossier.pending_correction?).to be_falsey
|
||||
expect(correction.reload.resolved_at).to be_present
|
||||
end
|
||||
|
||||
it 'creates a commentaire in the messagerie with expected wording' do
|
||||
passer_en_instruction
|
||||
|
||||
|
@ -1253,6 +1245,24 @@ describe Dossier, type: :model do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#can_passer_en_instruction?' do
|
||||
let(:dossier) { create(:dossier, :en_construction) }
|
||||
|
||||
it { expect(dossier.can_passer_en_instruction?).to be_truthy }
|
||||
|
||||
context 'when there is a pending correction' do
|
||||
before { create(:dossier_correction, dossier:) }
|
||||
|
||||
it { expect(dossier.can_passer_en_instruction?).to be_falsey }
|
||||
end
|
||||
|
||||
context 'when there is a resolved correction' do
|
||||
before { create(:dossier_correction, :resolved, dossier:) }
|
||||
|
||||
it { expect(dossier.can_passer_en_instruction?).to be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#can_passer_automatiquement_en_instruction?' do
|
||||
let(:dossier) { create(:dossier, :en_construction, declarative_triggered_at: declarative_triggered_at) }
|
||||
let(:declarative_triggered_at) { nil }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue