bug(filter): filtering types_de_champs.value with ilike is trickier than expected. indead, some enum might overlap on word ex: Favorable, Defavorable. Searching with ilike Favorable finds Defavorable

This commit is contained in:
mfo 2024-09-24 20:37:46 +02:00
parent b30cbf3032
commit 1339e10280
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC

View file

@ -530,6 +530,19 @@ describe ProcedurePresentation do
it { is_expected.to contain_exactly(kept_dossier.id) }
end
context 'with enum type_de_champ' do
let(:filter_value) { 'Favorable' }
let(:filter) { [{ 'table' => 'type_de_champ', 'column' => type_de_champ.stable_id.to_s, 'value_column' => :value, 'value' => filter_value }] }
let(:types_de_champ_public) { [{ type: :drop_down_list, options: ['Favorable', 'Defavorable'] }] }
before do
kept_dossier.champs.find_by(stable_id: type_de_champ.stable_id).update(value: 'Favorable')
discarded_dossier.champs.find_by(stable_id: type_de_champ.stable_id).update(external_id: 'Defavorable')
end
it { is_expected.to contain_exactly(kept_dossier.id) }
end
end
context 'for type_de_champ_private table' do