diff --git a/app/services/dossier_search_service.rb b/app/services/dossier_search_service.rb index d7c61d5f7..bc57cfd64 100644 --- a/app/services/dossier_search_service.rb +++ b/app/services/dossier_search_service.rb @@ -32,7 +32,6 @@ class DossierSearchService gestionnaire .dossiers - .not_archived .state_not_brouillon .where("#{ts_vector} @@ #{ts_query}") .order("COALESCE(ts_rank(#{ts_vector}, #{ts_query}), 0) DESC") diff --git a/spec/services/dossier_search_service_spec.rb b/spec/services/dossier_search_service_spec.rb index 511e809d2..b0b05798f 100644 --- a/spec/services/dossier_search_service_spec.rb +++ b/spec/services/dossier_search_service_spec.rb @@ -33,7 +33,7 @@ describe DossierSearchService do let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', siret: '41816609600051') } let!(:dossier_3) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_2, user: create(:user, email: 'peace@clap.fr'), etablissement: etablissement_3) } - let!(:dossier_archived) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) } + let!(:dossier_archived) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, archived: true, user: create(:user, email: 'archived@clap.fr')) } describe 'search is empty' do let(:terms) { '' } @@ -47,6 +47,12 @@ describe DossierSearchService do it { expect(subject.size).to eq(0) } end + describe 'search archived file' do + let(:terms) { 'archived' } + + it { expect(subject.size).to eq(1) } + end + describe 'search on contact email' do let(:terms) { 'clap' }