ajax-datatables-rails 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +5 -23
- data/.github/workflows/ci.yml +16 -8
- data/.gitignore +6 -3
- data/.rubocop.yml +1 -1
- data/Appraisals +18 -25
- data/CHANGELOG.md +14 -0
- data/Gemfile +2 -0
- data/README.md +15 -15
- data/ajax-datatables-rails.gemspec +5 -2
- data/appraisal.yml +56 -0
- data/bin/bundle +114 -0
- data/bin/rackup +27 -0
- data/config.ru +7 -0
- data/doc/migrate.md +1 -1
- data/gemfiles/rails_5.2.8.gemfile +21 -0
- data/gemfiles/rails_6.0.6.gemfile +21 -0
- data/gemfiles/rails_6.1.7.gemfile +21 -0
- data/gemfiles/rails_7.0.4.gemfile +21 -0
- data/lib/ajax-datatables-rails/base.rb +21 -1
- data/lib/ajax-datatables-rails/datatable/column/search.rb +8 -8
- data/lib/ajax-datatables-rails/datatable/column.rb +10 -9
- data/lib/ajax-datatables-rails/datatable/datatable.rb +0 -1
- data/lib/ajax-datatables-rails/version.rb +1 -1
- data/spec/ajax-datatables-rails/base_spec.rb +39 -19
- data/spec/ajax-datatables-rails/datatable/column_spec.rb +30 -33
- data/spec/ajax-datatables-rails/datatable/datatable_spec.rb +12 -10
- data/spec/ajax-datatables-rails/datatable/simple_order_spec.rb +5 -3
- data/spec/ajax-datatables-rails/datatable/simple_search_spec.rb +4 -2
- data/spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb +109 -120
- data/spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb +6 -4
- data/spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb +7 -5
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/routes.rb +5 -0
- data/spec/dummy/config/storage.yml +3 -0
- data/spec/{support → dummy/db}/schema.rb +3 -4
- data/spec/dummy/log/.gitignore +1 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/user.rb +3 -1
- data/spec/spec_helper.rb +32 -19
- data/spec/support/datatables/complex_datatable.rb +4 -0
- data/spec/support/datatables/complex_datatable_array.rb +2 -0
- data/spec/support/datatables/datatable_cond_date.rb +2 -0
- data/spec/support/datatables/datatable_cond_numeric.rb +2 -0
- data/spec/support/datatables/datatable_cond_proc.rb +2 -0
- data/spec/support/datatables/datatable_cond_string.rb +4 -2
- data/spec/support/datatables/datatable_cond_unknown.rb +2 -0
- data/spec/support/datatables/datatable_custom_column.rb +17 -0
- data/spec/support/datatables/datatable_order_nulls_last.rb +2 -0
- data/spec/support/helpers/params.rb +14 -6
- data/spec/support/models/user.rb +5 -0
- metadata +65 -12
- data/gemfiles/rails_5.2.4.gemfile +0 -11
- data/gemfiles/rails_6.0.3.gemfile +0 -11
- data/gemfiles/rails_6.1.0.gemfile +0 -11
- data/spec/ajax-datatables-rails/orm/active_record_spec.rb +0 -24
@@ -0,0 +1,25 @@
|
|
1
|
+
<% adapter = ENV.fetch('DB_ADAPTER', 'postgresql') %>
|
2
|
+
test:
|
3
|
+
adapter: <%= adapter %>
|
4
|
+
database: ajax_datatables_rails
|
5
|
+
encoding: utf8
|
6
|
+
|
7
|
+
<% if adapter == 'postgresql' %>
|
8
|
+
host: '127.0.0.1'
|
9
|
+
port: 5432
|
10
|
+
username: 'postgres'
|
11
|
+
password: 'postgres'
|
12
|
+
<% elsif adapter == 'mysql2' %>
|
13
|
+
host: '127.0.0.1'
|
14
|
+
port: 3306
|
15
|
+
username: 'root'
|
16
|
+
password: 'root'
|
17
|
+
<% elsif adapter == 'oracle_enhanced' %>
|
18
|
+
host: '127.0.0.1/xe'
|
19
|
+
username: <%= ENV.fetch('USER') %>
|
20
|
+
password: <%= ENV.fetch('USER') %>
|
21
|
+
database: 'xe'
|
22
|
+
<% elsif adapter == 'sqlite3' %>
|
23
|
+
# database: ':memory:'
|
24
|
+
database: db/ajax_datatables_rails.sqlite3
|
25
|
+
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
self.verbose = false
|
1
|
+
# frozen_string_literal: true
|
3
2
|
|
4
|
-
|
3
|
+
ActiveRecord::Schema.define do
|
4
|
+
create_table :users, force: true do |t|
|
5
5
|
t.string :username
|
6
6
|
t.string :email
|
7
7
|
t.string :first_name
|
@@ -10,5 +10,4 @@ ActiveRecord::Schema.define do
|
|
10
10
|
|
11
11
|
t.timestamps null: false
|
12
12
|
end
|
13
|
-
|
14
13
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
File without changes
|
data/spec/factories/user.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
FactoryBot.define do
|
2
4
|
factory :user do |f|
|
3
5
|
f.username { Faker::Internet.user_name }
|
4
6
|
f.email { Faker::Internet.email }
|
5
7
|
f.first_name { Faker::Name.first_name }
|
6
8
|
f.last_name { Faker::Name.last_name }
|
7
|
-
f.post_id { (
|
9
|
+
f.post_id { (1..100).to_a.sample }
|
8
10
|
end
|
9
11
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'combustion'
|
4
|
+
|
5
|
+
Combustion.path = 'spec/dummy'
|
6
|
+
Combustion.initialize! :active_record, :action_controller
|
7
|
+
|
1
8
|
require 'simplecov'
|
2
9
|
require 'rspec'
|
3
10
|
require 'rspec/retry'
|
@@ -5,9 +12,6 @@ require 'database_cleaner'
|
|
5
12
|
require 'factory_bot'
|
6
13
|
require 'faker'
|
7
14
|
require 'pry'
|
8
|
-
require 'rails'
|
9
|
-
require 'active_record'
|
10
|
-
require 'action_controller'
|
11
15
|
|
12
16
|
# Start Simplecov
|
13
17
|
SimpleCov.start do
|
@@ -36,40 +40,49 @@ RSpec.configure do |config|
|
|
36
40
|
DatabaseCleaner.clean_with(:truncation)
|
37
41
|
end
|
38
42
|
|
39
|
-
config.before
|
43
|
+
config.before do
|
40
44
|
DatabaseCleaner.strategy = :transaction
|
41
45
|
end
|
42
46
|
|
43
|
-
config.before
|
47
|
+
config.before do
|
44
48
|
DatabaseCleaner.start
|
45
49
|
end
|
46
50
|
|
47
|
-
config.after
|
51
|
+
config.after do
|
48
52
|
DatabaseCleaner.clean
|
49
53
|
end
|
50
54
|
|
55
|
+
# disable monkey patching
|
56
|
+
# see: https://relishapp.com/rspec/rspec-core/v/3-8/docs/configuration/zero-monkey-patching-mode
|
57
|
+
config.disable_monkey_patching!
|
58
|
+
|
51
59
|
if ENV.key?('GITHUB_ACTIONS')
|
52
|
-
config.around
|
60
|
+
config.around do |ex|
|
53
61
|
ex.run_with_retry retry: 3
|
54
62
|
end
|
55
63
|
end
|
56
64
|
end
|
57
65
|
|
58
|
-
|
66
|
+
class RunningSpec
|
67
|
+
def self.sqlite?
|
68
|
+
ENV['DB_ADAPTER'] == 'sqlite3'
|
69
|
+
end
|
59
70
|
|
60
|
-
|
71
|
+
def self.oracle?
|
72
|
+
ENV['DB_ADAPTER'] == 'oracle_enhanced'
|
73
|
+
end
|
61
74
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
encoding: 'utf8'
|
66
|
-
}
|
75
|
+
def self.mysql?
|
76
|
+
ENV['DB_ADAPTER'] == 'mysql2'
|
77
|
+
end
|
67
78
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
79
|
+
def self.postgresql?
|
80
|
+
ENV['DB_ADAPTER'] == 'postgresql'
|
81
|
+
end
|
82
|
+
end
|
72
83
|
|
73
|
-
|
84
|
+
# Require our gem
|
85
|
+
require 'ajax-datatables-rails'
|
74
86
|
|
87
|
+
# Load test helpers
|
75
88
|
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].sort.each { |f| require f }
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class ComplexDatatable < AjaxDatatablesRails::ActiveRecord
|
2
4
|
def view_columns
|
3
5
|
@view_columns ||= {
|
@@ -5,6 +7,7 @@ class ComplexDatatable < AjaxDatatablesRails::ActiveRecord
|
|
5
7
|
email: { source: 'User.email' },
|
6
8
|
first_name: { source: 'User.first_name' },
|
7
9
|
last_name: { source: 'User.last_name' },
|
10
|
+
full_name: { source: 'full_name' },
|
8
11
|
post_id: { source: 'User.post_id', orderable: false },
|
9
12
|
created_at: { source: 'User.created_at' },
|
10
13
|
}
|
@@ -17,6 +20,7 @@ class ComplexDatatable < AjaxDatatablesRails::ActiveRecord
|
|
17
20
|
email: record.email,
|
18
21
|
first_name: record.first_name,
|
19
22
|
last_name: record.last_name,
|
23
|
+
full_name: record.full_name,
|
20
24
|
post_id: record.post_id,
|
21
25
|
created_at: record.created_at,
|
22
26
|
}
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class DatatableCondStartWith < ComplexDatatable
|
2
4
|
def view_columns
|
3
5
|
super.deep_merge(first_name: { cond: :start_with })
|
@@ -24,7 +26,7 @@ end
|
|
24
26
|
|
25
27
|
class DatatableCondStringIn < ComplexDatatable
|
26
28
|
def view_columns
|
27
|
-
super.deep_merge(email: { cond: :string_in, formatter: ->
|
29
|
+
super.deep_merge(email: { cond: :string_in, formatter: ->(o) { o.split('|') } })
|
28
30
|
end
|
29
31
|
end
|
30
32
|
|
@@ -36,6 +38,6 @@ end
|
|
36
38
|
|
37
39
|
class DatatableWithFormater < ComplexDatatable
|
38
40
|
def view_columns
|
39
|
-
super.deep_merge(last_name: { formatter: ->
|
41
|
+
super.deep_merge(last_name: { formatter: ->(o) { o.upcase } })
|
40
42
|
end
|
41
43
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DatatableCustomColumn < ComplexDatatable
|
4
|
+
def view_columns
|
5
|
+
super.deep_merge(full_name: { cond: filter_full_name })
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_raw_records
|
9
|
+
User.select("*, CONCAT(first_name, ' ', last_name) as full_name")
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def filter_full_name
|
15
|
+
->(_column, value) { ::Arel::Nodes::SqlLiteral.new("CONCAT(first_name, ' ', last_name)").matches("#{value}%") }
|
16
|
+
end
|
17
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# rubocop:disable Metrics/MethodLength
|
2
4
|
def sample_params
|
3
5
|
ActionController::Parameters.new(
|
@@ -29,12 +31,18 @@ def sample_params
|
|
29
31
|
}
|
30
32
|
},
|
31
33
|
'4' => {
|
32
|
-
'data' => '
|
34
|
+
'data' => 'full_name', 'name' => '', 'searchable' => 'true', 'orderable' => 'true',
|
33
35
|
'search' => {
|
34
36
|
'value' => '', 'regex' => 'false'
|
35
37
|
}
|
36
38
|
},
|
37
39
|
'5' => {
|
40
|
+
'data' => 'post_id', 'name' => '', 'searchable' => 'true', 'orderable' => 'true',
|
41
|
+
'search' => {
|
42
|
+
'value' => '', 'regex' => 'false'
|
43
|
+
}
|
44
|
+
},
|
45
|
+
'6' => {
|
38
46
|
'data' => 'created_at', 'name' => '', 'searchable' => 'true', 'orderable' => 'true',
|
39
47
|
'search' => {
|
40
48
|
'value' => '', 'regex' => 'false'
|
@@ -42,7 +50,7 @@ def sample_params
|
|
42
50
|
},
|
43
51
|
},
|
44
52
|
'order' => {
|
45
|
-
'0' => {'column' => '0', 'dir' => 'asc'}
|
53
|
+
'0' => { 'column' => '0', 'dir' => 'asc' },
|
46
54
|
},
|
47
55
|
'start' => '0', 'length' => '10', 'search' => {
|
48
56
|
'value' => '', 'regex' => 'false'
|
@@ -54,8 +62,8 @@ end
|
|
54
62
|
|
55
63
|
def sample_params_json
|
56
64
|
hash_params = sample_params.to_unsafe_h
|
57
|
-
hash_params[
|
58
|
-
hash_params[
|
65
|
+
hash_params['columns'] = hash_params['columns'].values
|
66
|
+
hash_params['order'] = hash_params['order'].values
|
59
67
|
ActionController::Parameters.new(hash_params)
|
60
68
|
end
|
61
69
|
# rubocop:enable Metrics/MethodLength
|
@@ -63,9 +71,9 @@ end
|
|
63
71
|
def nulls_last_sql(datatable)
|
64
72
|
case datatable.db_adapter
|
65
73
|
when :pg, :postgresql, :postgres, :oracle
|
66
|
-
|
74
|
+
'NULLS LAST'
|
67
75
|
when :mysql, :mysql2, :sqlite, :sqlite3
|
68
|
-
|
76
|
+
'IS NULL'
|
69
77
|
else
|
70
78
|
raise 'unsupported database adapter'
|
71
79
|
end
|
data/spec/support/models/user.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ajax-datatables-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Quenneville
|
@@ -9,8 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '5.2'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '5.2'
|
14
28
|
- !ruby/object:Gem::Dependency
|
15
29
|
name: zeitwerk
|
16
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,6 +67,20 @@ dependencies:
|
|
53
67
|
- - ">="
|
54
68
|
- !ruby/object:Gem::Version
|
55
69
|
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: combustion
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.3'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.3'
|
56
84
|
- !ruby/object:Gem::Dependency
|
57
85
|
name: database_cleaner
|
58
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,19 +180,19 @@ dependencies:
|
|
152
180
|
- !ruby/object:Gem::Version
|
153
181
|
version: '0'
|
154
182
|
- !ruby/object:Gem::Dependency
|
155
|
-
name:
|
183
|
+
name: puma
|
156
184
|
requirement: !ruby/object:Gem::Requirement
|
157
185
|
requirements:
|
158
186
|
- - ">="
|
159
187
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
188
|
+
version: '0'
|
161
189
|
type: :development
|
162
190
|
prerelease: false
|
163
191
|
version_requirements: !ruby/object:Gem::Requirement
|
164
192
|
requirements:
|
165
193
|
- - ">="
|
166
194
|
- !ruby/object:Gem::Version
|
167
|
-
version: '
|
195
|
+
version: '0'
|
168
196
|
- !ruby/object:Gem::Dependency
|
169
197
|
name: rake
|
170
198
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +263,20 @@ dependencies:
|
|
235
263
|
- - ">="
|
236
264
|
- !ruby/object:Gem::Version
|
237
265
|
version: '0'
|
266
|
+
- !ruby/object:Gem::Dependency
|
267
|
+
name: sqlite3
|
268
|
+
requirement: !ruby/object:Gem::Requirement
|
269
|
+
requirements:
|
270
|
+
- - "~>"
|
271
|
+
- !ruby/object:Gem::Version
|
272
|
+
version: 1.4.0
|
273
|
+
type: :development
|
274
|
+
prerelease: false
|
275
|
+
version_requirements: !ruby/object:Gem::Requirement
|
276
|
+
requirements:
|
277
|
+
- - "~>"
|
278
|
+
- !ruby/object:Gem::Version
|
279
|
+
version: 1.4.0
|
238
280
|
description: A wrapper around datatable's ajax methods that allow synchronization
|
239
281
|
with server-side pagination in a rails app
|
240
282
|
email:
|
@@ -257,17 +299,22 @@ files:
|
|
257
299
|
- README.md
|
258
300
|
- Rakefile
|
259
301
|
- ajax-datatables-rails.gemspec
|
302
|
+
- appraisal.yml
|
260
303
|
- bin/_guard-core
|
261
304
|
- bin/appraisal
|
305
|
+
- bin/bundle
|
262
306
|
- bin/guard
|
307
|
+
- bin/rackup
|
263
308
|
- bin/rake
|
264
309
|
- bin/rspec
|
265
310
|
- bin/rubocop
|
311
|
+
- config.ru
|
266
312
|
- doc/migrate.md
|
267
313
|
- doc/webpack.md
|
268
|
-
- gemfiles/rails_5.2.
|
269
|
-
- gemfiles/rails_6.0.
|
270
|
-
- gemfiles/rails_6.1.
|
314
|
+
- gemfiles/rails_5.2.8.gemfile
|
315
|
+
- gemfiles/rails_6.0.6.gemfile
|
316
|
+
- gemfiles/rails_6.1.7.gemfile
|
317
|
+
- gemfiles/rails_7.0.4.gemfile
|
271
318
|
- lib/ajax-datatables-rails.rb
|
272
319
|
- lib/ajax-datatables-rails/active_record.rb
|
273
320
|
- lib/ajax-datatables-rails/base.rb
|
@@ -293,7 +340,13 @@ files:
|
|
293
340
|
- spec/ajax-datatables-rails/orm/active_record_filter_records_spec.rb
|
294
341
|
- spec/ajax-datatables-rails/orm/active_record_paginate_records_spec.rb
|
295
342
|
- spec/ajax-datatables-rails/orm/active_record_sort_records_spec.rb
|
296
|
-
- spec/
|
343
|
+
- spec/dummy/app/assets/config/manifest.js
|
344
|
+
- spec/dummy/config/database.yml
|
345
|
+
- spec/dummy/config/routes.rb
|
346
|
+
- spec/dummy/config/storage.yml
|
347
|
+
- spec/dummy/db/schema.rb
|
348
|
+
- spec/dummy/log/.gitignore
|
349
|
+
- spec/dummy/public/favicon.ico
|
297
350
|
- spec/factories/user.rb
|
298
351
|
- spec/install_oracle.sh
|
299
352
|
- spec/spec_helper.rb
|
@@ -304,10 +357,10 @@ files:
|
|
304
357
|
- spec/support/datatables/datatable_cond_proc.rb
|
305
358
|
- spec/support/datatables/datatable_cond_string.rb
|
306
359
|
- spec/support/datatables/datatable_cond_unknown.rb
|
360
|
+
- spec/support/datatables/datatable_custom_column.rb
|
307
361
|
- spec/support/datatables/datatable_order_nulls_last.rb
|
308
362
|
- spec/support/helpers/params.rb
|
309
363
|
- spec/support/models/user.rb
|
310
|
-
- spec/support/schema.rb
|
311
364
|
homepage: https://github.com/jbox-web/ajax-datatables-rails
|
312
365
|
licenses:
|
313
366
|
- MIT
|
@@ -324,14 +377,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
324
377
|
requirements:
|
325
378
|
- - ">="
|
326
379
|
- !ruby/object:Gem::Version
|
327
|
-
version: 2.
|
380
|
+
version: 2.7.0
|
328
381
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
329
382
|
requirements:
|
330
383
|
- - ">="
|
331
384
|
- !ruby/object:Gem::Version
|
332
385
|
version: '0'
|
333
386
|
requirements: []
|
334
|
-
rubygems_version: 3.
|
387
|
+
rubygems_version: 3.3.26
|
335
388
|
signing_key:
|
336
389
|
specification_version: 4
|
337
390
|
summary: A gem that simplifies using datatables and hundreds of records via ajax
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "5.2.4"
|
6
|
-
gem "activerecord-oracle_enhanced-adapter", "~> 5.2.0"
|
7
|
-
gem "sqlite3", "~> 1.3.0"
|
8
|
-
gem "mysql2"
|
9
|
-
gem "ruby-oci8" if ENV["DB_ADAPTER"] == "oracle_enhanced"
|
10
|
-
|
11
|
-
gemspec path: "../"
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "6.0.3"
|
6
|
-
gem "activerecord-oracle_enhanced-adapter", "~> 6.0.0"
|
7
|
-
gem "sqlite3", "~> 1.4.0"
|
8
|
-
gem "mysql2"
|
9
|
-
gem "ruby-oci8" if ENV["DB_ADAPTER"] == "oracle_enhanced"
|
10
|
-
|
11
|
-
gemspec path: "../"
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rails", "6.1.0"
|
6
|
-
gem "activerecord-oracle_enhanced-adapter", "~> 6.1.0"
|
7
|
-
gem "sqlite3", "~> 1.4.0"
|
8
|
-
gem "mysql2"
|
9
|
-
gem "ruby-oci8" if ENV["DB_ADAPTER"] == "oracle_enhanced"
|
10
|
-
|
11
|
-
gemspec path: "../"
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe AjaxDatatablesRails::ORM::ActiveRecord do
|
4
|
-
context 'Private API' do
|
5
|
-
let(:datatable) { ComplexDatatable.new(sample_params) }
|
6
|
-
|
7
|
-
before(:each) do
|
8
|
-
create(:user, username: 'johndoe', email: 'johndoe@example.com')
|
9
|
-
create(:user, username: 'msmith', email: 'mary.smith@example.com')
|
10
|
-
end
|
11
|
-
|
12
|
-
describe '#fetch_records' do
|
13
|
-
it 'calls #get_raw_records' do
|
14
|
-
expect(datatable).to receive(:get_raw_records) { User.all }
|
15
|
-
datatable.fetch_records
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'returns a collection of records' do
|
19
|
-
expect(datatable).to receive(:get_raw_records) { User.all }
|
20
|
-
expect(datatable.fetch_records).to be_a(ActiveRecord::Relation)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|