summaryrefslogtreecommitdiff
path: root/test/test_delegate.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-15 08:07:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-15 08:07:39 +0000
commitca5739979dc932e809cb70d243ecc07d380d2725 (patch)
tree69296750e2afc4d25a0466cb3f51ac1668334923 /test/test_delegate.rb
parent3eac78dd88982c2f1388d7a974c58ed5d2214e12 (diff)
delegate.rb: get rid of global function interference
* lib/delegate.rb (Delegator#send): override to get rid of global function interference. [Fixes GH-449] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_delegate.rb')
-rw-r--r--test/test_delegate.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_delegate.rb b/test/test_delegate.rb
index a09451b..d816a62 100644
--- a/test/test_delegate.rb
+++ b/test/test_delegate.rb
@@ -133,4 +133,16 @@ class TestDelegateClass < Test::Unit::TestCase
assert_raise(NoMethodError, '[ruby-dev:40314]#4') {d.delegate_test_private}
assert_raise(NoMethodError, '[ruby-dev:40314]#5') {d.send(:delegate_test_private)}
end
+
+ def test_global_function
+ klass = Class.new do
+ def open
+ end
+ end
+ obj = klass.new
+ d = SimpleDelegator.new(obj)
+ assert_nothing_raised(ArgumentError) {obj.open}
+ assert_nothing_raised(ArgumentError) {d.open}
+ assert_nothing_raised(ArgumentError) {d.send(:open)}
+ end
end