Permalink
Browse files

RailsInit => RailsInitializer

  • Loading branch information...
1 parent d0c8d7b commit 4cac54c0bbe0c990dd6749ac29b1b4c07160f4eb @joshuaclayton joshuaclayton committed Jan 15, 2010
@@ -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)
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
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
@@ -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"

0 comments on commit 4cac54c

Please sign in to comment.