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:
parent
b30cbf3032
commit
1339e10280
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue