display batch operation alerts

This commit is contained in:
Lisa Durand 2022-12-01 11:22:20 +01:00 committed by mfo
parent 2615da1e28
commit 7b3cbcb8f6
3 changed files with 6 additions and 17 deletions

View file

@ -12,7 +12,6 @@
%p
= t('.finish.text_fail', count: @batch.failed_dossier_ids.count)
- set_seen_at!
- if @batch.beginning?
= render Dsfr::AlertComponent.new(title: t('.in_progress.title'), state: :info) do |c|
- c.body do

View file

@ -46,7 +46,6 @@ RSpec.describe Dossiers::BatchAlertComponent, type: :component do
expect(batch_operation.seen_at).not_to eq(nil)
expect(subject).not_to have_text("2 dossiers ont été archivés")
end
end
context 'finished and fail' do

View file

@ -342,31 +342,22 @@ describe Instructeurs::ProceduresController, type: :controller do
it { expect(assigns(:filtered_sorted_paginated_ids)).to match_array([termine_dossier, termine_dossier_on_gi_2].map(&:id)) }
end
context 'with batch operations attached to the instructeur and his group' do
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur, groupe_instructeurs: [gi_2]) }
context 'with batch operations' do
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur) }
let!(:termine_dossier_2) { create(:dossier, :accepte, procedure: procedure) }
let!(:batch_operation_2) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier_2], instructeur: instructeur, groupe_instructeurs: [gi_2]) }
let!(:batch_operation_2) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier_2], instructeur: instructeur) }
before { subject }
it { expect(assigns(:batch_operations)).to match_array([batch_operation, batch_operation_2]) }
end
context 'with a batch operation not attached to the instructeur and his group' do
context 'with a batch operation not attached to the instructeur' do
let(:instructeur_2) { create(:instructeur) }
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur_2, groupe_instructeurs: [gi_3]) }
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur_2) }
before { subject }
it { expect(assigns(:batch_operations)).to eq([]) }
end
context 'with a batch operation not attached to the instructeur but to his group' do
let(:instructeur_2) { create(:instructeur) }
let!(:batch_operation) { create(:batch_operation, operation: :archiver, dossiers: [termine_dossier], instructeur: instructeur_2, groupe_instructeurs: [gi_2]) }
before { subject }
it { expect(assigns(:batch_operations)).to match_array([batch_operation]) }
it { expect(assigns(:batch_operations)).to eq(nil) }
end
end