From 9e27295a36ef6e754b862725c9ac961d4a3047dd Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Fri, 11 Oct 2024 11:44:58 +0200 Subject: [PATCH] fix(admin): all procedures really filtered by tags --- .../procedures_controller_spec.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/controllers/administrateurs/procedures_controller_spec.rb b/spec/controllers/administrateurs/procedures_controller_spec.rb index 5dfd47e12..72b097a5d 100644 --- a/spec/controllers/administrateurs/procedures_controller_spec.rb +++ b/spec/controllers/administrateurs/procedures_controller_spec.rb @@ -290,18 +290,23 @@ describe Administrateurs::ProceduresController, type: :controller do end it 'returns procedure who contains at least one tag included in params' do - get :all, params: { procedure_tag_names: ['environnement'] } - expect(assigns(:procedures).any? { |p| p.id == procedure.id }).to be_truthy + get :all, params: { tags: ['environnement'] } + expect(assigns(:procedures).find { |p| p.id == procedure.id }).to be_present end it 'returns procedures who contains all tags included in params' do - get :all, params: { procedure_tag_names: ['environnement', 'diplomatie'] } - expect(assigns(:procedures).any? { |p| p.id == procedure.id }).to be_truthy + get :all, params: { tags: ['environnement', 'diplomatie'] } + expect(assigns(:procedures).find { |p| p.id == procedure.id }).to be_present end it 'returns the procedure when at least one tag is include' do - get :all, params: { procedure_tag_names: ['environnement', 'diplomatie', 'football'] } - expect(assigns(:procedures).any? { |p| p.id == procedure.id }).to be_truthy + get :all, params: { tags: ['environnement', 'diplomatie', 'football'] } + expect(assigns(:procedures).find { |p| p.id == procedure.id }).to be_present + end + + it 'does not return procedure not having the queried tag' do + get :all, params: { tags: ['football'] } + expect(assigns(:procedures)).to be_empty end end