diff options
author | Alexander Momchilov <alexander.momchilov@shopify.com> | 2022-07-27 10:19:37 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-08-09 01:31:24 +0900 |
commit | 71f89c287459d5ca313d0b1a16b7a743e0d71b8b (patch) | |
tree | cec765a3077ee3b37793517ae955fec538fd0d0b /test/psych/test_object.rb | |
parent | 0b7cfdca09651f2eae5cd0e8ae4efed5033493f2 (diff) |
[ruby/psych] Don't hardcode expected alias names
https://github.com/ruby/psych/commit/b9ab19094f
Diffstat (limited to 'test/psych/test_object.rb')
-rw-r--r-- | test/psych/test_object.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/test/psych/test_object.rb b/test/psych/test_object.rb index 648a3ca6a5..227a1d1d53 100644 --- a/test/psych/test_object.rb +++ b/test/psych/test_object.rb @@ -36,22 +36,19 @@ module Psych def test_cyclic_references foo = Foo.new(nil) foo.parent = foo - loaded = Psych.unsafe_load Psych.dump foo + loaded = Psych.load(Psych.dump(foo), permitted_classes: [Foo], aliases: true) assert_instance_of(Foo, loaded) - assert_equal loaded, loaded.parent + assert_same loaded, loaded.parent end def test_cyclic_reference_uses_alias foo = Foo.new(nil) foo.parent = foo - expected = <<~eoyaml - --- &1 !ruby/object:Psych::Foo - parent: *1 - eoyaml - - assert_equal expected, Psych.dump(foo) + assert_raise(BadAlias) do + Psych.load(Psych.dump(foo), permitted_classes: [Foo], aliases: false) + end end end end |