1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

ActiveSupport::BufferedLogger can be subclassed

This commit is contained in:
Yves Senn 2012-12-25 15:50:35 +01:00
parent 501175e3ad
commit 433ebbdc4c
2 changed files with 20 additions and 2 deletions

View file

@ -2,6 +2,10 @@ require 'active_support/deprecation'
require 'active_support/logger'
module ActiveSupport
BufferedLogger = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(
'BufferedLogger', '::ActiveSupport::Logger')
class BufferedLogger < Logger
def self.inherited(*)
::ActiveSupport::Deprecation.warn 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
super
end
end
end

View file

@ -0,0 +1,14 @@
require 'abstract_unit'
require 'active_support/buffered_logger'
class BufferedLoggerTest < ActiveSupport::TestCase
def test_can_be_subclassed
warn = 'ActiveSupport::BufferedLogger is deprecated! Use ActiveSupport::Logger instead.'
ActiveSupport::Deprecation.expects(:warn).with(warn).once
Class.new(ActiveSupport::BufferedLogger)
end
end