test/ruby/test_enum.rb: Prevent a warning

20211109T063003Z.log.html.gz
```
[ 1960/21145] TestEnumerable#test_to_a_keywords/home/chkbuild/chkbuild/tmp/build/20211109T063003Z/ruby/test/ruby/test_enum.rb:138: warning: method redefined; discarding old each
/home/chkbuild/chkbuild/tmp/build/20211109T063003Z/ruby/test/ruby/test_enum.rb:11: warning: previous definition of each was here
 = 0.00 s
```
This commit is contained in:
Yusuke Endoh 2021-11-09 17:30:28 +09:00
parent d5ae892519
commit cf50f9484a

View file

@ -135,6 +135,7 @@ class TestEnumerable < Test::Unit::TestCase
end end
def test_to_a_keywords def test_to_a_keywords
@obj.singleton_class.remove_method(:each)
def @obj.each(foo:) yield foo end def @obj.each(foo:) yield foo end
assert_equal([1], @obj.to_a(foo: 1)) assert_equal([1], @obj.to_a(foo: 1))
end end