Permalink
Browse files

r3219@asus: jeremy | 2005-11-20 03:07:19 -0800

 silence necessary warnings in logger test.  guard against multiple requires in kernel test.


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3131 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 7ed37c8 commit d1ac316fa4b3d2aae8314362a961d06f96922478 @jeremy jeremy committed Nov 21, 2005
Showing with 17 additions and 12 deletions.
  1. +16 −11 activesupport/test/clean_logger_test.rb
  2. +1 −1 activesupport/test/core_ext/kernel_test.rb
@@ -1,6 +1,7 @@
require 'test/unit'
require 'stringio'
require File.dirname(__FILE__) + '/../lib/active_support/clean_logger'
+require File.dirname(__FILE__) + '/../lib/active_support/core_ext/kernel.rb' unless defined? silence_warnings
class CleanLoggerTest < Test::Unit::TestCase
def setup
@@ -45,26 +46,30 @@ def test_silence
class CleanLogger_182_to_183_Test < Test::Unit::TestCase
def setup
- if Logger.method_defined?(:formatter=)
- Logger.send(:alias_method, :hide_formatter=, :formatter=)
- Logger.send(:undef_method, :formatter=)
- else
- Logger.send(:define_method, :formatter=) { }
+ silence_warnings do
+ if Logger.method_defined?(:formatter=)
+ Logger.send(:alias_method, :hide_formatter=, :formatter=)
+ Logger.send(:undef_method, :formatter=)
+ else
+ Logger.send(:define_method, :formatter=) { }
+ end
+ load File.dirname(__FILE__) + '/../lib/active_support/clean_logger.rb'
end
- load File.dirname(__FILE__) + '/../lib/active_support/clean_logger.rb'
@out = StringIO.new
@logger = Logger.new(@out)
@logger.progname = 'CLEAN LOGGER TEST'
end
def teardown
- if Logger.method_defined?(:hide_formatter=)
- Logger.send(:alias_method, :formatter=, :hide_formatter=)
- else
- Logger.send(:undef_method, :formatter=)
+ silence_warnings do
+ if Logger.method_defined?(:hide_formatter=)
+ Logger.send(:alias_method, :formatter=, :hide_formatter=)
+ else
+ Logger.send(:undef_method, :formatter=)
+ end
+ load File.dirname(__FILE__) + '/../lib/active_support/clean_logger.rb'
end
- load File.dirname(__FILE__) + '/../lib/active_support/clean_logger.rb'
end
# Since we've fooled Logger into thinking we're on 1.8.2 if we're on 1.8.3
@@ -1,5 +1,5 @@
require 'test/unit'
-require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/kernel'
+require File.dirname(__FILE__) + '/../../lib/active_support/core_ext/kernel' unless defined? silence_warnings
class KernelTest < Test::Unit::TestCase
def test_silence_warnings

0 comments on commit d1ac316

Please sign in to comment.