fix search and add system spec

This commit is contained in:
Lisa Durand 2023-07-20 16:56:59 +02:00
parent 8ed1e97ee1
commit 385d4b4fa5
3 changed files with 16 additions and 2 deletions

View file

@ -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?

View file

@ -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

View file

@ -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