diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_proc.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index f09e58e926..5c12043873 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -58,7 +58,10 @@ class TestProc < Test::Unit::TestCase b = assert_warn(/Capturing the given block using Proc\.new is deprecated/) do Proc.new end - meta.class_eval {define_method(:foo, b)} + meta.class_eval { + remove_method(:foo) if method_defined?(:foo) + define_method(:foo, b) + } assert_equal(n, method(:foo).arity) end |