Permalink
Browse files

Merge pull request #1235 from joshk/deprecate_kernel_requires

Deprecate kernel requires
  • Loading branch information...
2 parents 65f54a6 + d79e284 commit b648286a0cdb8f5a7e56ee70784734f1272363e4 @josevalim josevalim committed May 23, 2011
@@ -1,4 +1,5 @@
require 'active_support/core_ext/kernel/reporting'
+require 'active_support/core_ext/module/deprecation'
module Kernel
# Require a library with fallback to RubyGems. Warnings during library
@@ -23,4 +24,5 @@ def require_library_or_gem(library_name)
end
end
end
+ deprecate :require_library_or_gem
end
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'active_support/core_ext/kernel'
-class KernelTest < Test::Unit::TestCase
+class KernelTest < ActiveSupport::TestCase
def test_silence_warnings
silence_warnings { assert_nil $VERBOSE }
assert_equal 1234, silence_warnings { 1234 }
@@ -52,11 +52,17 @@ def test_class_eval
class << o; @x = 1; end
assert_equal 1, o.class_eval { @x }
end
-
+
def test_capture
assert_equal 'STDERR', capture(:stderr) {$stderr.print 'STDERR'}
assert_equal 'STDOUT', capture(:stdout) {print 'STDOUT'}
end
+
+ def test_require_library_or_gem_deprecated
+ assert_deprecated do
+ require_library_or_gem 'i18n'
+ end
+ end
end
class KernelSuppressTest < Test::Unit::TestCase

0 comments on commit b648286

Please sign in to comment.