diff options
author | Étienne Barrié <etienne.barrie@gmail.com> | 2016-08-30 13:29:07 -0400 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-13 11:29:42 +0900 |
commit | 2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60 (patch) | |
tree | 38d501e176f0772c5766284b284d4a9c25d1f3d9 /test | |
parent | 24964fff92cd89925d2169ad97a357a5bc57e3e1 (diff) | |
download | ruby-2dc613815d2c4a69bfbcbf78d1b99aa52fbabf60.tar.gz |
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')
-rw-r--r-- | test/test_delegate.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb index 5320520de3..ffc4d9527e 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 |