diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-21 07:29:27 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-21 07:29:27 +0000 |
commit | d1ac316fa4b3d2aae8314362a961d06f96922478 (patch) | |
tree | d59b2133f97a1ac36a1dbeab635206e6222a92f6 /activesupport/test | |
parent | 7ed37c82a9d8d5d8df8b18d6baaf1ecc4abd06f8 (diff) | |
download | rails-d1ac316fa4b3d2aae8314362a961d06f96922478.tar.gz rails-d1ac316fa4b3d2aae8314362a961d06f96922478.tar.bz2 rails-d1ac316fa4b3d2aae8314362a961d06f96922478.zip |
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
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/clean_logger_test.rb | 27 | ||||
-rw-r--r-- | activesupport/test/core_ext/kernel_test.rb | 2 |
2 files changed, 17 insertions, 12 deletions
diff --git a/activesupport/test/clean_logger_test.rb b/activesupport/test/clean_logger_test.rb index 2ff3fd6832..fabbc4af03 100644 --- a/activesupport/test/clean_logger_test.rb +++ b/activesupport/test/clean_logger_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,13 +46,15 @@ end 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) @@ -59,12 +62,14 @@ class CleanLogger_182_to_183_Test < Test::Unit::TestCase 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 diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index e2d89176b9..72fd57f6ca 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -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 |