diff --git a/spec/ajax-datatables-rails/datatable/simple_order_spec.rb b/spec/ajax-datatables-rails/datatable/simple_order_spec.rb index cae8e37c..28f20058 100644 --- a/spec/ajax-datatables-rails/datatable/simple_order_spec.rb +++ b/spec/ajax-datatables-rails/datatable/simple_order_spec.rb @@ -18,6 +18,8 @@ after { AjaxDatatablesRails.config.nulls_last = false } it 'sql query' do + skip('unsupported database adapter') if ENV['DB_ADAPTER'] == 'oracle_enhanced' + expect(simple_order.query('email')).to eq( "email DESC #{nulls_last_sql}" ) diff --git a/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb b/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb index b55b770b..a15202b4 100644 --- a/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb +++ b/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb @@ -126,7 +126,7 @@ expect(result).to be_a(Arel::Nodes::And) end - if AjaxDatatablesRails.config.db_adapter == :postgresql + if ENV['DB_ADAPTER'] == 'postgresql' context 'when db_adapter is postgresql' do it 'can call #to_sql on returned object' do result = datatable.build_conditions_for_selected_columns @@ -138,7 +138,7 @@ end end - if AjaxDatatablesRails.config.db_adapter.in? %i[oracle oracleenhanced] + if ENV['DB_ADAPTER'] == 'oracle_enhanced' context 'when db_adapter is oracle' do it 'can call #to_sql on returned object' do result = datatable.build_conditions_for_selected_columns @@ -150,7 +150,7 @@ end end - if AjaxDatatablesRails.config.db_adapter.in? %i[mysql2 sqlite3] + if ENV['DB_ADAPTER'] == 'mysql2' context 'when db_adapter is mysql2' do it 'can call #to_sql on returned object' do result = datatable.build_conditions_for_selected_columns @@ -288,7 +288,7 @@ create(:user, last_name: 'MARY') end - if AjaxDatatablesRails.config.db_adapter == :oracleenhanced + if ENV['DB_ADAPTER'] == 'oracle_enhanced' context 'when db_adapter is oracleenhanced' do it 'should filter records matching' do datatable.params[:columns]['3'][:search][:value] = 'RY' diff --git a/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb b/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb index d4964178..51689833 100644 --- a/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb +++ b/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb @@ -16,8 +16,8 @@ end it 'paginates records properly' do - if AjaxDatatablesRails.config.db_adapter.in? %i[oracle oracleenhanced] - if Rails.version.in? %w[4.0.13 4.1.16 4.2.10] + if ENV['DB_ADAPTER'] == 'oracle_enhanced' + if Rails.version.in? %w[4.2.11] expect(datatable.paginate_records(records).to_sql).to include( 'rownum <= 10' ) @@ -34,8 +34,8 @@ datatable.params[:start] = '26' datatable.params[:length] = '25' - if AjaxDatatablesRails.config.db_adapter.in? %i[oracle oracleenhanced] - if Rails.version.in? %w[4.0.13 4.1.16 4.2.10] + if ENV['DB_ADAPTER'] == 'oracle_enhanced' + if Rails.version.in? %w[4.2.11] expect(datatable.paginate_records(records).to_sql).to include( 'rownum <= 51' ) diff --git a/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb b/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb index ba74fe01..1c0e8cad 100644 --- a/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb +++ b/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb @@ -49,6 +49,8 @@ after { AjaxDatatablesRails.config.nulls_last = false } it 'can handle multiple sorting columns' do + skip('unsupported database adapter') if ENV['DB_ADAPTER'] == 'oracle_enhanced' + # set to order by Users username in ascending order, and # by Users email in descending order datatable.params[:order]['0'] = { column: '0', dir: 'asc' } @@ -61,6 +63,8 @@ describe '#sort_records with nulls last using column config' do it 'can handle multiple sorting columns' do + skip('unsupported database adapter') if ENV['DB_ADAPTER'] == 'oracle_enhanced' + # set to order by Users username in ascending order, and # by Users email in descending order nulls_last_datatable.params[:order]['0'] = { column: '0', dir: 'asc' }