module ActiveSupport::LogSubscriber::TestHelper
def set_logger(logger)
ActiveRecord::Base.logger = @logger
def logger
Overwrite if you use another logger in your log subscriber.
def set_logger(logger) ActiveSupport::LogSubscriber.logger = logger end
def setup # :nodoc:
def setup # :nodoc: @logger = MockLogger.new @notifier = ActiveSupport::Notifications::Fanout.new ActiveSupport::LogSubscriber.colorize_logging = false @old_notifier = ActiveSupport::Notifications.notifier set_logger(@logger) ActiveSupport::Notifications.notifier = @notifier end
def teardown # :nodoc:
def teardown # :nodoc: set_logger(nil) ActiveSupport::Notifications.notifier = @old_notifier end
def wait
def wait @notifier.wait end