mirror of
https://github.com/kaminari/kaminari.git
synced 2022-11-09 13:44:37 -05:00
spec for model inheritance
This commit is contained in:
parent
689642275c
commit
f534a63b63
2 changed files with 9 additions and 5 deletions
|
@ -53,6 +53,9 @@ class Book < ActiveRecord::Base
|
|||
has_many :authors, :through => :authorships, :source => :user
|
||||
has_many :readers, :through => :readerships, :source => :user
|
||||
end
|
||||
# a model that is a descendant of AR::Base but doesn't directly inherit AR::Base
|
||||
class Admin < User
|
||||
end
|
||||
|
||||
# controllers
|
||||
class ApplicationController < ActionController::Base; end
|
||||
|
|
|
@ -10,12 +10,13 @@ shared_examples_for 'blank page' do
|
|||
end
|
||||
|
||||
describe Kaminari::ActiveRecordExtension do
|
||||
[User, GemDefinedModel].each do |model_class|
|
||||
context "for #{model_class}" do
|
||||
before :all do
|
||||
1.upto(100) {|i| model_class.create! :name => "user#{'%03d' % i}", :age => (i / 10)}
|
||||
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)}
|
||||
end
|
||||
|
||||
[User, Admin, GemDefinedModel].each do |model_class|
|
||||
context "for #{model_class}" do
|
||||
describe '#page' do
|
||||
context 'page 1' do
|
||||
subject { model_class.page 1 }
|
||||
|
|
Loading…
Add table
Reference in a new issue