Skip to content

Commit be332cc

Browse files
author
Nicolas Rodriguez
committed
Use Ruby NotImplementedError exception as it exists since Ruby 1.9
1 parent b024a43 commit be332cc

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/ajax-datatables-rails/base.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
module AjaxDatatablesRails
2-
class NotImplemented < StandardError; end
3-
42
class Base
53
extend Forwardable
64

@@ -24,15 +22,15 @@ def datatable
2422
end
2523

2624
def view_columns
27-
fail(NotImplemented, view_columns_error_text)
25+
fail(NotImplementedError, view_columns_error_text)
2826
end
2927

3028
def get_raw_records
31-
fail(NotImplemented, raw_records_error_text)
29+
fail(NotImplementedError, raw_records_error_text)
3230
end
3331

3432
def data
35-
fail(NotImplemented, data_error_text)
33+
fail(NotImplementedError, data_error_text)
3634
end
3735

3836
def additional_datas

spec/ajax-datatables-rails/base_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
describe '#view_columns' do
2222
it 'raises an error if not defined by the user' do
2323
datatable = described_class.new(view)
24-
expect { datatable.view_columns }.to raise_error AjaxDatatablesRails::NotImplemented
24+
expect { datatable.view_columns }.to raise_error NotImplementedError
2525
end
2626

2727
context 'child class implements view_columns' do
@@ -35,14 +35,14 @@
3535
describe '#get_raw_records' do
3636
it 'raises an error if not defined by the user' do
3737
datatable = described_class.new(view)
38-
expect { datatable.get_raw_records }.to raise_error AjaxDatatablesRails::NotImplemented
38+
expect { datatable.get_raw_records }.to raise_error NotImplementedError
3939
end
4040
end
4141

4242
describe '#data' do
4343
it 'raises an error if not defined by the user' do
4444
datatable = described_class.new(view)
45-
expect { datatable.data }.to raise_error AjaxDatatablesRails::NotImplemented
45+
expect { datatable.data }.to raise_error NotImplementedError
4646
end
4747

4848
context 'when data is defined as a hash' do

0 commit comments

Comments
 (0)