diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-05-17 13:36:55 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-05-17 13:36:55 +0900 |
commit | a0e97b0e2e4314a0815d09beb825e38f234778da (patch) | |
tree | 0c55d7b50efeb8daaee6dd469de30b7a7effcf80 /spec/ruby | |
parent | dfecc650c3f9bbd8b4fb0eefc1e3da65f151d3a8 (diff) | |
download | ruby-a0e97b0e2e4314a0815d09beb825e38f234778da.tar.gz |
Use YAML.unsafe_load instead of YAML.load.
This is a temporary workaround. We should rewrite the examples with
permitted_classes.
Diffstat (limited to 'spec/ruby')
-rw-r--r-- | spec/ruby/library/yaml/load_spec.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/ruby/library/yaml/load_spec.rb b/spec/ruby/library/yaml/load_spec.rb index 0b6bef2dac..f375577ccd 100644 --- a/spec/ruby/library/yaml/load_spec.rb +++ b/spec/ruby/library/yaml/load_spec.rb @@ -99,7 +99,7 @@ describe "YAML.load" do Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ] } - YAML.load($complex_key_1).should == expected + YAML.unsafe_load($complex_key_1).should == expected end it "loads a symbol key that contains spaces" do @@ -110,26 +110,26 @@ describe "YAML.load" do describe "with iso8601 timestamp" do it "computes the microseconds" do - [ [YAML.load("2011-03-22t23:32:11.2233+01:00"), 223300], - [YAML.load("2011-03-22t23:32:11.0099+01:00"), 9900], - [YAML.load("2011-03-22t23:32:11.000076+01:00"), 76] + [ [YAML.unsafe_load("2011-03-22t23:32:11.2233+01:00"), 223300], + [YAML.unsafe_load("2011-03-22t23:32:11.0099+01:00"), 9900], + [YAML.unsafe_load("2011-03-22t23:32:11.000076+01:00"), 76] ].should be_computed_by(:usec) end it "rounds values smaller than 1 usec to 0 " do - YAML.load("2011-03-22t23:32:11.000000342222+01:00").usec.should == 0 + YAML.unsafe_load("2011-03-22t23:32:11.000000342222+01:00").usec.should == 0 end end it "loads an OpenStruct" do require "ostruct" os = OpenStruct.new("age" => 20, "name" => "John") - loaded = YAML.load("--- !ruby/object:OpenStruct\ntable:\n :age: 20\n :name: John\n") + loaded = YAML.unsafe_load("--- !ruby/object:OpenStruct\ntable:\n :age: 20\n :name: John\n") loaded.should == os end it "loads a File but raise an error when used as it is uninitialized" do - loaded = YAML.load("--- !ruby/object:File {}\n") + loaded = YAML.unsafe_load("--- !ruby/object:File {}\n") -> { loaded.read(1) }.should raise_error(IOError) |