feat(instructeur): pending correction blocks passer en instruction

Closes #9731
This commit is contained in:
Colin Darie 2023-12-07 17:32:39 +01:00
parent ecc3638d81
commit c26b59722d
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
9 changed files with 60 additions and 18 deletions

View file

@ -56,7 +56,7 @@ describe 'instructeurs/dossiers/show', type: :view do
let(:dossier) { create(:dossier, :en_construction) }
it 'displays the correct actions' do
within("form[action=\"#{passer_en_instruction_instructeur_dossier_path(dossier.procedure, dossier)}\"]") do
expect(subject).to have_button('Passer en instruction')
expect(subject).to have_button('Passer en instruction', disabled: false)
end
within("form[action=\"#{follow_instructeur_dossier_path(dossier.procedure, dossier)}\"]") do
expect(subject).to have_button('Suivre le dossier')
@ -64,6 +64,15 @@ describe 'instructeurs/dossiers/show', type: :view do
expect(subject).to have_button('Demander une correction')
expect(subject).to have_selector('.header-actions ul:first-child > li.instruction-button', count: 1)
end
context 'with pending correction' do
before { create(:dossier_correction, dossier:) }
it 'disable the instruction button' do
expect(subject).to have_button('Passer en instruction', disabled: true)
expect(subject).to have_content('Le passage en instruction est impossible')
end
end
end
context 'en_instruction' do