Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

RailsInit => RailsInitializer

  • Loading branch information...
commit 4cac54c0bbe0c990dd6749ac29b1b4c07160f4eb 1 parent d0c8d7b
Joshua Clayton joshuaclayton authored
4 lib/hoptoad_notifier/rails_init.rb → lib/hoptoad_notifier/rails_initializer.rb
View
@@ -1,7 +1,7 @@
module HoptoadNotifier
# used to initialize Rails-specific code
- class RailsInit
- def initialize
+ class RailsInitializer
+ def self.initialize
rails_logger = if defined?(Rails.logger)
Rails.logger
elsif defined?(RAILS_DEFAULT_LOGGER)
4 rails/init.rb
View
@@ -2,8 +2,8 @@
ActionController::Base.send(:include, HoptoadNotifier::Catcher)
end
-require File.join(File.dirname(__FILE__), '..', 'lib', 'hoptoad_notifier', 'rails_init')
-HoptoadNotifier::RailsInit.new
+require File.join(File.dirname(__FILE__), '..', 'lib', 'hoptoad_notifier', 'rails_initializer')
+HoptoadNotifier::RailsInitializer.initialize
HoptoadNotifier.configure(true) do |config|
config.environment_name = RAILS_ENV
2  test/logger_test.rb
View
@@ -42,7 +42,7 @@ def configure
should "not report that notifier is ready when internally configured" do
stub_verbose_log
- HoptoadNotifier.configure(true) { |config | }
+ HoptoadNotifier.configure(true) { |config| }
assert_not_logged /.*/
end
10 test/rails_init_test.rb → test/rails_initializer_test.rb
View
@@ -1,7 +1,7 @@
require File.dirname(__FILE__) + '/helper'
-require File.join(File.dirname(__FILE__), '..', 'lib', 'hoptoad_notifier', 'rails_init')
+require File.join(File.dirname(__FILE__), '..', 'lib', 'hoptoad_notifier', 'rails_initializer')
-class RailsInitTest < Test::Unit::TestCase
+class RailsInitializerTest < Test::Unit::TestCase
include DefinesConstants
should "trigger use of Rails' logger if logger isn't set and Rails' logger exists" do
@@ -11,20 +11,20 @@ def self.logger
end
end
define_constant("Rails", rails)
- HoptoadNotifier::RailsInit.new
+ HoptoadNotifier::RailsInitializer.initialize
assert_equal "RAILS LOGGER", HoptoadNotifier.logger
end
should "trigger use of Rails' default logger if logger isn't set and Rails.logger doesn't exist" do
define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
- HoptoadNotifier::RailsInit.new
+ HoptoadNotifier::RailsInitializer.initialize
assert_equal "RAILS DEFAULT LOGGER", HoptoadNotifier.logger
end
should "allow overriding of the logger if already assigned" do
define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
- HoptoadNotifier::RailsInit.new
+ HoptoadNotifier::RailsInitializer.initialize
HoptoadNotifier.configure(true) do |config|
config.logger = "OVERRIDDEN LOGGER"
Please sign in to comment.
Something went wrong with that request. Please try again.