diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 26051c8ec..41521f313 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -335,6 +335,7 @@ module Users end def recherche + @all_dossiers_uniq_procedures_count = 0 @search_terms = params[:q] return redirect_to dossiers_path if @search_terms.blank? diff --git a/spec/system/users/list_dossiers_spec.rb b/spec/system/users/list_dossiers_spec.rb index a0d4e4e7e..92689a46f 100644 --- a/spec/system/users/list_dossiers_spec.rb +++ b/spec/system/users/list_dossiers_spec.rb @@ -50,9 +50,9 @@ describe 'user access to the list of their dossiers', js: true do let(:dossiers_per_page) { 2 } scenario 'the user can navigate through the other pages' do - expect(page).not_to have_content(dossier_en_instruction.procedure.libelle) + expect(page).not_to have_link(dossier_en_instruction.procedure.libelle) page.click_link("Suivant") - expect(page).to have_content(dossier_en_instruction.procedure.libelle) + expect(page).to have_link(dossier_en_instruction.procedure.libelle) expect(page).to have_text('5 en cours') expect(page).to have_text('2 traités') end @@ -256,4 +256,16 @@ describe 'user access to the list of their dossiers', js: true do end end end + + describe "filter by procedure" do + context "when dossiers are on different procedures" do + it "can filter by procedure" do + expect(page).to have_text('5 en cours') + expect(page).to have_text('2 traités') + expect(page).to have_select('procedure_id', selected: 'Toutes les démarches') + select dossier_brouillon.procedure.libelle, from: 'procedure_id' + expect(page).to have_text('1 en cours') + end + end + end end diff --git a/spec/views/users/dossiers/index.html.haml_spec.rb b/spec/views/users/dossiers/index.html.haml_spec.rb index 0b34cf2b4..3f9eacd84 100644 --- a/spec/views/users/dossiers/index.html.haml_spec.rb +++ b/spec/views/users/dossiers/index.html.haml_spec.rb @@ -21,6 +21,7 @@ describe 'users/dossiers/index', type: :view do assign(:dossiers, Kaminari.paginate_array(user_dossiers).page(1)) assign(:statut, statut) assign(:filter, filter) + assign(:all_dossiers_uniq_procedures_count, 0) render end