From 48edaf8b8a03ef7a1c4f936c8c92e9dcf4271872 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 14 Nov 2019 13:00:25 +0900 Subject: test/ruby/test_proc.rb: suppress "method redefined" warnings --- test/ruby/test_proc.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3