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

Fix the exception to be raised

`NoMethodError` has been raised instead of `FrozenError`.
This commit is contained in:
Nobuyoshi Nakada 2019-12-31 18:04:08 +09:00
parent 2e1fd4e2d7
commit 8caeef7c1d
Notes: git 2019-12-31 19:44:00 +09:00

View file

@ -837,9 +837,9 @@ end.join
def test_frozen_error_receiver
obj = Object.new.freeze
(obj.foo = 1) rescue (e = $!)
e = assert_raise(FrozenError) {def obj.foo; end}
assert_same(obj, e.receiver)
obj.singleton_class.const_set(:A, 2) rescue (e = $!)
e = assert_raise(FrozenError) {obj.singleton_class.const_set(:A, 2)}
assert_same(obj.singleton_class, e.receiver)
end