summaryrefslogtreecommitdiff
path: root/test/test_delegate.rb
diff options
context:
space:
mode:
authorÉtienne Barrié <etienne.barrie@gmail.com>2016-08-30 13:29:07 -0400
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-13 11:29:42 +0900
commit2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60 (patch)
tree38d501e176f0772c5766284b284d4a9c25d1f3d9 /test/test_delegate.rb
parent24964fff92cd89925d2169ad97a357a5bc57e3e1 (diff)
delegate.rb: don't look for methods on Kernel
Instead, look for instance methods of Kernel. Otherwise, instance methods of Module (which are methods of Kernel itself) are mistakenly believed to exist, and it fails when calling Kernel.instance_method(). Closes: https://github.com/ruby/ruby/pull/1422
Diffstat (limited to 'test/test_delegate.rb')
-rw-r--r--test/test_delegate.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb
index 5320520..ffc4d95 100644
--- a/test/test_delegate.rb
+++ b/test/test_delegate.rb
@@ -258,4 +258,11 @@ class TestDelegateClass < Test::Unit::TestCase
def test_dir_in_delegator_class
assert_equal(__dir__, Bug9403::DC.dir_name, Bug9403::Name)
end
+
+ def test_module_methods_vs_kernel_methods
+ delegate = SimpleDelegator.new(Object.new)
+ assert_raise(NoMethodError) do
+ delegate.constants
+ end
+ end
end