File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
spec/ajax-datatables-rails/orm Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 420420 end
421421 end
422422
423+ context 'proc condition' do
424+ describe 'it can filter records with lambda/proc condition' do
425+ let ( :datatable ) { DatatableCondProc . new ( sample_params ) }
426+
427+ before ( :each ) do
428+ create ( :user , username : 'johndoe' , email : 'johndoe@example.com' )
429+ create ( :user , username : 'johndie' , email : 'johndie@example.com' )
430+ create ( :user , username : 'msmith' , email : 'mary.smith@example.com' )
431+ end
432+
433+ it 'should filter records matching' do
434+ datatable . params [ :columns ] [ '0' ] [ :search ] [ :value ] = 'john'
435+ expect ( datatable . data . size ) . to eq 2
436+ item = datatable . data . first
437+ expect ( item [ :username ] ) . to eq 'johndie'
438+ end
439+ end
440+ end
441+
423442 context 'string condition' do
424443 describe 'it can filter records with condition :start_with' do
425444 let ( :datatable ) { DatatableCondStartWith . new ( sample_params ) }
You can’t perform that action at this time.
0 commit comments