1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

The Rails module could be defined by some other gem than rails

kaminari depends on actionpack that in turn depends on rails-html-sanitizer the line https://github.com/amatsuda/kaminari/blob/master/lib/kaminari.rb#L36
returns true because rails-html-sanitizer defines the class Rails::Html::Sanitizer: https://github.com/rails/rails-html-sanitizer/blob/master/lib/rails-html-sanitizer.rb
see: https://github.com/amatsuda/kaminari/issues/796#issue-158648760

closes #796
This commit is contained in:
Akira Matsuda 2016-06-07 14:07:08 +09:00
parent 8a14d33aa1
commit b7257f1442
4 changed files with 5 additions and 5 deletions

View file

@ -8,7 +8,7 @@ rescue LoadError
#do nothing
end
$stderr.puts <<-EOC if !defined?(Rails) && !defined?(Sinatra) && !defined?(Grape)
$stderr.puts <<-EOC if !defined?(::Rails::Railtie) && !defined?(Sinatra) && !defined?(Grape)
warning: no framework detected.
Your Gemfile might not be configured properly.
@ -33,7 +33,7 @@ require 'kaminari/models/configuration_methods'
require 'kaminari/hooks'
# if not using Railtie, call `Kaminari::Hooks.init` directly
if defined? Rails
if defined? ::Rails::Railtie
require 'kaminari/railtie'
require 'kaminari/engine'
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
if defined?(Rails)
if defined?(::Rails::Railtie)
require 'rails/generators'
require 'generators/kaminari/views_generator'

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe 'Kaminari::ActionViewExtension', :if => defined?(Rails)do
describe 'Kaminari::ActionViewExtension', :if => defined?(::Rails::Railtie) do
describe '#paginate' do
before do
50.times {|i| User.create! :name => "user#{i}"}

View file

@ -15,7 +15,7 @@ require 'database_cleaner'
# Simulate a gem providing a subclass of ActiveRecord::Base before the Railtie is loaded.
require 'fake_gem' if defined? ActiveRecord
if defined? Rails
if defined? ::Rails::Railtie
require 'fake_app/rails_app'
require 'rspec/rails'