File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed
spec/ajax-datatables-rails Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 18
18
after { AjaxDatatablesRails . config . nulls_last = false }
19
19
20
20
it 'sql query' do
21
+ skip ( 'unsupported database adapter' ) if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
22
+
21
23
expect ( simple_order . query ( 'email' ) ) . to eq (
22
24
"email DESC #{ nulls_last_sql } "
23
25
)
Original file line number Diff line number Diff line change 126
126
expect ( result ) . to be_a ( Arel ::Nodes ::And )
127
127
end
128
128
129
- if AjaxDatatablesRails . config . db_adapter == : postgresql
129
+ if ENV [ 'DB_ADAPTER' ] == ' postgresql'
130
130
context 'when db_adapter is postgresql' do
131
131
it 'can call #to_sql on returned object' do
132
132
result = datatable . build_conditions_for_selected_columns
138
138
end
139
139
end
140
140
141
- if AjaxDatatablesRails . config . db_adapter . in? %i[ oracle oracleenhanced ]
141
+ if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
142
142
context 'when db_adapter is oracle' do
143
143
it 'can call #to_sql on returned object' do
144
144
result = datatable . build_conditions_for_selected_columns
150
150
end
151
151
end
152
152
153
- if AjaxDatatablesRails . config . db_adapter . in? %i[ mysql2 sqlite3 ]
153
+ if ENV [ 'DB_ADAPTER' ] == 'mysql2'
154
154
context 'when db_adapter is mysql2' do
155
155
it 'can call #to_sql on returned object' do
156
156
result = datatable . build_conditions_for_selected_columns
288
288
create ( :user , last_name : 'MARY' )
289
289
end
290
290
291
- if AjaxDatatablesRails . config . db_adapter == :oracleenhanced
291
+ if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
292
292
context 'when db_adapter is oracleenhanced' do
293
293
it 'should filter records matching' do
294
294
datatable . params [ :columns ] [ '3' ] [ :search ] [ :value ] = 'RY'
Original file line number Diff line number Diff line change 16
16
end
17
17
18
18
it 'paginates records properly' do
19
- if AjaxDatatablesRails . config . db_adapter . in? %i[ oracle oracleenhanced ]
20
- if Rails . version . in? %w[ 4.0.13 4.1.16 4.2.10 ]
19
+ if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
20
+ if Rails . version . in? %w[ 4.2.11 ]
21
21
expect ( datatable . paginate_records ( records ) . to_sql ) . to include (
22
22
'rownum <= 10'
23
23
)
34
34
35
35
datatable . params [ :start ] = '26'
36
36
datatable . params [ :length ] = '25'
37
- if AjaxDatatablesRails . config . db_adapter . in? %i[ oracle oracleenhanced ]
38
- if Rails . version . in? %w[ 4.0.13 4.1.16 4.2.10 ]
37
+ if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
38
+ if Rails . version . in? %w[ 4.2.11 ]
39
39
expect ( datatable . paginate_records ( records ) . to_sql ) . to include (
40
40
'rownum <= 51'
41
41
)
Original file line number Diff line number Diff line change 49
49
after { AjaxDatatablesRails . config . nulls_last = false }
50
50
51
51
it 'can handle multiple sorting columns' do
52
+ skip ( 'unsupported database adapter' ) if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
53
+
52
54
# set to order by Users username in ascending order, and
53
55
# by Users email in descending order
54
56
datatable . params [ :order ] [ '0' ] = { column : '0' , dir : 'asc' }
61
63
62
64
describe '#sort_records with nulls last using column config' do
63
65
it 'can handle multiple sorting columns' do
66
+ skip ( 'unsupported database adapter' ) if ENV [ 'DB_ADAPTER' ] == 'oracle_enhanced'
67
+
64
68
# set to order by Users username in ascending order, and
65
69
# by Users email in descending order
66
70
nulls_last_datatable . params [ :order ] [ '0' ] = { column : '0' , dir : 'asc' }
You can’t perform that action at this time.
0 commit comments