Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change rails? method to check railtie instead rails module #221

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/sitemap_generator/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module SitemapGenerator
class Application
def rails?
defined?(Rails)
defined?(Rails::Railtie)
end

# Returns a boolean indicating whether this environment is Rails 3
Expand Down
3 changes: 2 additions & 1 deletion spec/sitemap_generator/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
describe SitemapGenerator::Application do
before :all do
SitemapGenerator::Utilities.with_warnings(nil) do
Object.const_set(:Rails, Object.new)
Object.const_set(:Rails, Object)
Object::Rails.const_set(:Railtie, Object)
end
end

Expand Down