Skip to content

Commit

Permalink
Add test that checks if AR's abstract_class option plays together wit…
Browse files Browse the repository at this point in the history
…h kaminari
  • Loading branch information
yuki24 committed Nov 11, 2013
1 parent 5242e88 commit e6f266a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions spec/fake_app/active_record/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,6 +58,7 @@ def self.up
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
Expand Down
3 changes: 2 additions & 1 deletion spec/models/active_record/scopes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
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
Expand Down

0 comments on commit e6f266a

Please sign in to comment.