Skip to content

Commit f5ee338

Browse files
committed
Fix tests on Oracle DB
1 parent 6b8fc55 commit f5ee338

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

spec/ajax-datatables-rails/datatable/simple_order_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
after { AjaxDatatablesRails.config.nulls_last = false }
1919

2020
it 'sql query' do
21+
skip('unsupported database adapter') if ENV['DB_ADAPTER'] == 'oracle_enhanced'
22+
2123
expect(simple_order.query('email')).to eq(
2224
"email DESC #{nulls_last_sql}"
2325
)

spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
expect(result).to be_a(Arel::Nodes::And)
127127
end
128128

129-
if AjaxDatatablesRails.config.db_adapter == :postgresql
129+
if ENV['DB_ADAPTER'] == 'postgresql'
130130
context 'when db_adapter is postgresql' do
131131
it 'can call #to_sql on returned object' do
132132
result = datatable.build_conditions_for_selected_columns
@@ -138,7 +138,7 @@
138138
end
139139
end
140140

141-
if AjaxDatatablesRails.config.db_adapter.in? %i[oracle oracleenhanced]
141+
if ENV['DB_ADAPTER'] == 'oracle_enhanced'
142142
context 'when db_adapter is oracle' do
143143
it 'can call #to_sql on returned object' do
144144
result = datatable.build_conditions_for_selected_columns
@@ -150,7 +150,7 @@
150150
end
151151
end
152152

153-
if AjaxDatatablesRails.config.db_adapter.in? %i[mysql2 sqlite3]
153+
if ENV['DB_ADAPTER'] == 'mysql2'
154154
context 'when db_adapter is mysql2' do
155155
it 'can call #to_sql on returned object' do
156156
result = datatable.build_conditions_for_selected_columns
@@ -288,7 +288,7 @@
288288
create(:user, last_name: 'MARY')
289289
end
290290

291-
if AjaxDatatablesRails.config.db_adapter == :oracleenhanced
291+
if ENV['DB_ADAPTER'] == 'oracle_enhanced'
292292
context 'when db_adapter is oracleenhanced' do
293293
it 'should filter records matching' do
294294
datatable.params[:columns]['3'][:search][:value] = 'RY'

spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
end
1717

1818
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]
2121
expect(datatable.paginate_records(records).to_sql).to include(
2222
'rownum <= 10'
2323
)
@@ -34,8 +34,8 @@
3434

3535
datatable.params[:start] = '26'
3636
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]
3939
expect(datatable.paginate_records(records).to_sql).to include(
4040
'rownum <= 51'
4141
)

spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
after { AjaxDatatablesRails.config.nulls_last = false }
5050

5151
it 'can handle multiple sorting columns' do
52+
skip('unsupported database adapter') if ENV['DB_ADAPTER'] == 'oracle_enhanced'
53+
5254
# set to order by Users username in ascending order, and
5355
# by Users email in descending order
5456
datatable.params[:order]['0'] = { column: '0', dir: 'asc' }
@@ -61,6 +63,8 @@
6163

6264
describe '#sort_records with nulls last using column config' do
6365
it 'can handle multiple sorting columns' do
66+
skip('unsupported database adapter') if ENV['DB_ADAPTER'] == 'oracle_enhanced'
67+
6468
# set to order by Users username in ascending order, and
6569
# by Users email in descending order
6670
nulls_last_datatable.params[:order]['0'] = { column: '0', dir: 'asc' }

0 commit comments

Comments
 (0)