aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-07-20 21:20:19 +0200
committerJosé Valim <jose.valim@gmail.com>2010-07-20 21:21:14 +0200
commitd4151d7f0ac4a0823e788c0beed9ec2476e72386 (patch)
tree79576edab9209c77bfb118296ee40f4bad9b7a64 /activesupport/lib/active_support
parente1df4b956882f0c10a310088c1c13dcaa655a3b1 (diff)
downloadrails-d4151d7f0ac4a0823e788c0beed9ec2476e72386.tar.gz
rails-d4151d7f0ac4a0823e788c0beed9ec2476e72386.tar.bz2
rails-d4151d7f0ac4a0823e788c0beed9ec2476e72386.zip
Fix a failing test in Railtie and properly define all severity levels in MockLogger for LogSubscriber.
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.