mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
Add test that checks if AR's abstract_class option plays together with kaminari
This commit is contained in:
parent
5242e88985
commit
e6f266acb5
2 changed files with 10 additions and 1 deletions
|
@ -42,6 +42,13 @@ class User::Address < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
end
|
||||
|
||||
# a class that uses abstract class
|
||||
class Product < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
class Device < Product
|
||||
end
|
||||
|
||||
#migrations
|
||||
class CreateAllTables < ActiveRecord::Migration
|
||||
def self.up
|
||||
|
@ -51,6 +58,7 @@ class CreateAllTables < ActiveRecord::Migration
|
|||
create_table(:readerships) {|t| t.integer :user_id; t.integer :book_id }
|
||||
create_table(:authorships) {|t| t.integer :user_id; t.integer :book_id }
|
||||
create_table(:user_addresses) {|t| t.string :street; t.integer :user_id }
|
||||
create_table(:devices) {|t| t.string :name; t.integer :age}
|
||||
end
|
||||
end
|
||||
ActiveRecord::Migration.verbose = false
|
||||
|
|
|
@ -15,9 +15,10 @@ if defined? ActiveRecord
|
|||
before do
|
||||
1.upto(100) {|i| User.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
|
||||
1.upto(100) {|i| GemDefinedModel.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
|
||||
1.upto(100) {|i| Device.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
|
||||
end
|
||||
|
||||
[User, Admin, GemDefinedModel].each do |model_class|
|
||||
[User, Admin, GemDefinedModel, Device].each do |model_class|
|
||||
context "for #{model_class}" do
|
||||
describe '#page' do
|
||||
context 'page 1' do
|
||||
|
|
Loading…
Reference in a new issue