aboutsummaryrefslogtreecommitdiffstats
path: root/test/ostruct/test_ostruct.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-rw-r--r--test/ostruct/test_ostruct.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index a15de36c23..d89bc94cc3 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -66,15 +66,16 @@ class TC_OpenStruct < Test::Unit::TestCase
o = OpenStruct.new(foo: 42)
o.a = 'a'
o.freeze
- assert_raise(FrozenError) {o.b = 'b'}
+ expected_error = defined?(FrozenError) ? FrozenError : RuntimeError
+ assert_raise(expected_error) {o.b = 'b'}
assert_not_respond_to(o, :b)
- assert_raise(FrozenError) {o.a = 'z'}
+ assert_raise(expected_error) {o.a = 'z'}
assert_equal('a', o.a)
assert_equal(42, o.foo)
o = OpenStruct.new :a => 42
def o.frozen?; nil end
o.freeze
- assert_raise(FrozenError, '[ruby-core:22559]') {o.a = 1764}
+ assert_raise(expected_error, '[ruby-core:22559]') {o.a = 1764}
end
def test_delete_field