From 4405423c871698c36e4e4f24d89f17033b18b19c Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Thu, 24 Sep 2020 19:30:22 +0900 Subject: [PATCH] test/ostruct/test_ostruct.rb: Prevent "method redefined; discarding old foo" --- test/ostruct/test_ostruct.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 8fa7ba6229..0628094306 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -184,12 +184,15 @@ class TC_OpenStruct < Test::Unit::TestCase end def test_does_not_redefine + $VERBOSE, verbose_bak = nil, $VERBOSE os = OpenStruct.new(foo: 42) def os.foo 43 end os.foo = 44 assert_equal(43, os.foo) + ensure + $VERBOSE = verbose_bak end def test_allocate_subclass