fix specs

This commit is contained in:
Lisa Durand 2023-04-27 15:26:10 +02:00
parent 74b28a995f
commit b76c0a36e8
3 changed files with 7 additions and 0 deletions

View file

@ -91,6 +91,7 @@
= render partial: "deleted_dossiers_list", locals: { deleted_dossiers: @dossiers }
- if @statut == "dossiers-transferes"
-# /!\ in this context, @dossiers is a collection of DossierTransfer not Dossier
= render partial: "transfered_dossiers_list", locals: { dossier_transfers: @dossiers }
- if @statut == "dossiers-expirant"

View file

@ -3,6 +3,7 @@ describe 'user access to the list of their dossiers', js: true do
let!(:dossier_brouillon) { create(:dossier, user: user) }
let!(:dossier_en_construction) { create(:dossier, :with_populated_champs, :en_construction, user: user) }
let!(:dossier_en_instruction) { create(:dossier, :en_instruction, user: user) }
let!(:dossier_traite) { create(:dossier, :accepte, user: user) }
let!(:dossier_archived) { create(:dossier, :en_instruction, :archived, user: user) }
let(:dossiers_per_page) { 25 }
let(:last_updated_dossier) { dossier_en_construction }
@ -26,6 +27,8 @@ describe 'user access to the list of their dossiers', js: true do
expect(page).to have_content(dossier_en_construction.procedure.libelle)
expect(page).to have_content(dossier_en_instruction.procedure.libelle)
expect(page).to have_content(dossier_archived.procedure.libelle)
expect(page).to have_text('4 en cours')
expect(page).to have_text('1 traité')
end
it 'the list must be ordered by last updated' do
@ -47,6 +50,8 @@ describe 'user access to the list of their dossiers', js: true do
expect(page).not_to have_content(dossier_en_instruction.procedure.libelle)
page.click_link("Suivant")
expect(page).to have_content(dossier_en_instruction.procedure.libelle)
expect(page).to have_text('4 en cours')
expect(page).to have_text('1 traité')
end
end

View file

@ -17,6 +17,7 @@ describe 'users/dossiers/index.html.haml', type: :view do
assign(:dossiers_traites, Kaminari.paginate_array(user_dossiers).page(1))
assign(:dossier_transfers, Kaminari.paginate_array([]).page(1))
assign(:dossiers_close_to_expiration, Kaminari.paginate_array([]).page(1))
assign(:dossiers, Kaminari.paginate_array(user_dossiers).page(1))
assign(:statut, statut)
render
end