forked from kaminari/kaminari
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure that Kaminari does not conflict with other gems that extend the inherited hook
- Loading branch information
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,20 @@ | ||
# Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded. | ||
module Kaminari | ||
module FakeGem | ||
extend ActiveSupport::Concern | ||
|
||
class GemDefinedModel < ActiveRecord::Base | ||
module ClassMethods | ||
def inherited(kls) | ||
super | ||
def kls.fake_gem_defined_method; end | ||
end | ||
end | ||
end | ||
end | ||
|
||
ActiveSupport.on_load :active_record do | ||
ActiveRecord::Base.send :include, Kaminari::FakeGem | ||
|
||
# Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded. | ||
class GemDefinedModel < ActiveRecord::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require 'spec_helper' | ||
|
||
if defined? ActiveRecord | ||
describe Kaminari::ActiveRecordModelExtension do | ||
subject { Class.new(ActiveRecord::Base) } | ||
it { should respond_to :page } | ||
it { should respond_to :fake_gem_defined_method } | ||
end | ||
end |