From d245e1255910d8c2510d6ec470dcce0349c8f981 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Fri, 4 Nov 2022 16:02:51 +0100 Subject: [PATCH] remove render_views in spec and correct the way to retrieve dossiers --- app/controllers/recherche_controller.rb | 2 +- spec/controllers/recherche_controller_spec.rb | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/controllers/recherche_controller.rb b/app/controllers/recherche_controller.rb index 4216d339a..83586eca6 100644 --- a/app/controllers/recherche_controller.rb +++ b/app/controllers/recherche_controller.rb @@ -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 # to display an alert in the view 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 diff --git a/spec/controllers/recherche_controller_spec.rb b/spec/controllers/recherche_controller_spec.rb index 0270f55db..597bec755 100644 --- a/spec/controllers/recherche_controller_spec.rb +++ b/spec/controllers/recherche_controller_spec.rb @@ -1,6 +1,4 @@ describe RechercheController, type: :controller do - render_views - let(:procedure) { create(:procedure, :published, @@ -76,7 +74,7 @@ describe RechercheController, type: :controller do it 'does not return the dossier' do subject expect(assigns(:projected_dossiers).count).to eq(0) - expect(response.body).not_to match(/