diff --git a/kaminari-core/test/models/active_record/scopes_test.rb b/kaminari-core/test/models/active_record/scopes_test.rb index e519f76..15b9a31 100644 --- a/kaminari-core/test/models/active_record/scopes_test.rb +++ b/kaminari-core/test/models/active_record/scopes_test.rb @@ -2,6 +2,8 @@ require 'test_helper' if defined? ActiveRecord + require 'activerecord-import' + class ActiveRecordModelExtensionTest < ActiveSupport::TestCase test 'Changing page_method_name' do begin @@ -30,8 +32,11 @@ if defined? ActiveRecord class << self def startup [User, GemDefinedModel, Device].each do |m| - 1.upto(100) {|i| m.create! name: "user#{'%03d' % i}", age: (i / 10)} + collection = 1.upto(100).map {|i| m.new(name: "user#{'%03d' % i}", age: (i / 10)) } + + insert(collection) end + super end @@ -39,6 +44,10 @@ if defined? ActiveRecord [User, GemDefinedModel, Device].each(&:delete_all) super end + + def insert(collection) + collection.first.class.import collection + end end [User, Admin, GemDefinedModel, Device].each do |model_class| diff --git a/kaminari.gemspec b/kaminari.gemspec index 277aef6..c1f378c 100644 --- a/kaminari.gemspec +++ b/kaminari.gemspec @@ -27,4 +27,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rake', '>= 0' spec.add_development_dependency 'rr', '>= 0' spec.add_development_dependency 'capybara', '>= 1.0' + spec.add_development_dependency 'activerecord-import' end