aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/log_subscriber/test_helper.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/log_subscriber/test_helper.rb b/activesupport/lib/active_support/log_subscriber/test_helper.rb
index 0f5fc3554b..9e52cb97a9 100644
--- a/activesupport/lib/active_support/log_subscriber/test_helper.rb
+++ b/activesupport/lib/active_support/log_subscriber/test_helper.rb
@@ -1,4 +1,5 @@
require 'active_support/log_subscriber'
+require 'active_support/buffered_logger'
module ActiveSupport
class LogSubscriber
@@ -47,13 +48,14 @@ module ActiveSupport
end
class MockLogger
+ include ActiveSupport::BufferedLogger::Severity
+
attr_reader :flush_count
- attr_accessor :debugging
- alias :debug? :debugging
+ attr_accessor :level
- def initialize
+ def initialize(level = DEBUG)
@flush_count = 0
- @debugging = false
+ @level = level
@logged = Hash.new { |h,k| h[k] = [] }
end
@@ -68,6 +70,14 @@ module ActiveSupport
def flush
@flush_count += 1
end
+
+ ActiveSupport::BufferedLogger::Severity.constants.each do |severity|
+ class_eval <<-EOT, __FILE__, __LINE__ + 1
+ def #{severity.downcase}?
+ #{severity} >= @level
+ end
+ EOT
+ end
end
# Wait notifications to be published.