summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-09-24 10:30:22 (GMT)
committerYusuke Endoh <mame@ruby-lang.org>2020-09-24 10:30:22 (GMT)
commit4405423c871698c36e4e4f24d89f17033b18b19c (patch)
treeeebec154ced9f188c3f22ae812a7d030dda35321
parent416bb11a5e9c4062295392765191cdedcecc522a (diff)
test/ostruct/test_ostruct.rb: Prevent "method redefined; discarding old foo"
-rw-r--r--test/ostruct/test_ostruct.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 8fa7ba6..0628094 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