1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/ostruct/test_ostruct.rb: Prevent "method redefined; discarding old foo"

This commit is contained in:
Yusuke Endoh 2020-09-24 19:30:22 +09:00
parent 416bb11a5e
commit 4405423c87

View file

@ -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