remove render_views in spec and correct the way to retrieve dossiers
This commit is contained in:
parent
ba0799b684
commit
d245e12559
2 changed files with 3 additions and 6 deletions
|
@ -32,7 +32,7 @@ class RechercheController < ApplicationController
|
||||||
# we want to retrieve dossiers that are not accessible to the instructor because he is not in the instructor group
|
# we want to retrieve dossiers that are not accessible to the instructor because he is not in the instructor group
|
||||||
# to display an alert in the view
|
# to display an alert in the view
|
||||||
instructeur_procedure_dossiers_ids = DossierSearchService
|
instructeur_procedure_dossiers_ids = DossierSearchService
|
||||||
.matching_dossiers(current_instructeur&.procedures&.map(&:dossiers)&.first, @search_terms, with_annotation: true)
|
.matching_dossiers(Dossier.joins(:procedure).where(procedure: {id: current_instructeur&.procedures&.ids}), @search_terms, with_annotation: true)
|
||||||
|
|
||||||
not_in_instructor_group_dossiers_ids = instructeur_procedure_dossiers_ids - matching_dossiers_ids
|
not_in_instructor_group_dossiers_ids = instructeur_procedure_dossiers_ids - matching_dossiers_ids
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
describe RechercheController, type: :controller do
|
describe RechercheController, type: :controller do
|
||||||
render_views
|
|
||||||
|
|
||||||
let(:procedure) {
|
let(:procedure) {
|
||||||
create(:procedure,
|
create(:procedure,
|
||||||
:published,
|
:published,
|
||||||
|
@ -76,7 +74,7 @@ describe RechercheController, type: :controller do
|
||||||
it 'does not return the dossier' do
|
it 'does not return the dossier' do
|
||||||
subject
|
subject
|
||||||
expect(assigns(:projected_dossiers).count).to eq(0)
|
expect(assigns(:projected_dossiers).count).to eq(0)
|
||||||
expect(response.body).not_to match(/<div class='fr-alert fr-alert--info/)
|
expect(assigns(:not_in_instructor_group_dossiers).count).to eq(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -94,8 +92,7 @@ describe RechercheController, type: :controller do
|
||||||
it 'does not return the dossier but it returns a message' do
|
it 'does not return the dossier but it returns a message' do
|
||||||
subject
|
subject
|
||||||
expect(assigns(:projected_dossiers).count).to eq(0)
|
expect(assigns(:projected_dossiers).count).to eq(0)
|
||||||
expect(response.body).to match(/Aucun dossier correspondant à votre recherche n’a été trouvé/)
|
expect(assigns(:not_in_instructor_group_dossiers)).to eq([dossier3])
|
||||||
expect(CGI.unescapeHTML(response.body)).to match(/Le dossier n° #{dossier3.id} de la procédure « #{dossier3.procedure.libelle} » correspond à votre recherche mais il est rattaché au groupe d'instructeurs « #{dossier3.groupe_instructeur.label} »./)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue