diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2020-09-26 01:27:23 -0400 |
---|---|---|
committer | Marc-André Lafortune <github@marc-andre.ca> | 2020-09-30 18:11:24 -0400 |
commit | b36a45c05cafc227ade3b59349482953321d6a89 (patch) | |
tree | d166ac4aa87cab243740e599dc186c23e2c4ce1a /spec | |
parent | 0e93118c44fc4128bcacfe1dc6702c84a84b862b (diff) | |
download | ruby-b36a45c05cafc227ade3b59349482953321d6a89.tar.gz |
[ruby/ostruct] Improved YAML serialization.
Patch adapted from Pietro Monteiro [Fixes bug#8382]
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/library/yaml/dump_spec.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/spec/ruby/library/yaml/dump_spec.rb b/spec/ruby/library/yaml/dump_spec.rb index 5af794b7f8..9e884b0fd7 100644 --- a/spec/ruby/library/yaml/dump_spec.rb +++ b/spec/ruby/library/yaml/dump_spec.rb @@ -37,7 +37,9 @@ describe "YAML.dump" do it "dumps an OpenStruct" do require "ostruct" os = OpenStruct.new("age" => 20, "name" => "John") - YAML.dump(os).should match_yaml("--- !ruby/object:OpenStruct\ntable:\n :age: 20\n :name: John\n") + os2 = YAML.load(YAML.dump(os)) + os2.age.should == 20 + os2.name.should == "John" end it "dumps a File without any state" do |