diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-11-06 12:35:18 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-11-06 12:58:21 +0900 |
commit | 18c3e2d9f1f1d5fc90d95bfa118982aaebc75928 (patch) | |
tree | 3c72a6872c1d9387cdbc4d1f081022fa162e2577 | |
parent | c690ca03f33441f299d0b59e4a91fc22bf1781bf (diff) |
Assert newly added warning in `JSON.load`
-rw-r--r-- | spec/ruby/security/cve_2020_10663_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/ruby/security/cve_2020_10663_spec.rb b/spec/ruby/security/cve_2020_10663_spec.rb index cce1beb012..03f004efeb 100644 --- a/spec/ruby/security/cve_2020_10663_spec.rb +++ b/spec/ruby/security/cve_2020_10663_spec.rb @@ -29,7 +29,14 @@ guard -> { JSON.parse(json, create_additions: true).class.should == JSONSpecs::MyClass JSON(json, create_additions: true).class.should == JSONSpecs::MyClass - JSON.load(json).class.should == JSONSpecs::MyClass + if version_is(JSON::VERSION, '2.8.0') + warning = /\Wcreate_additions:\s*true\W\s+is\s+deprecated/ + else + warning = '' + end + -> { + JSON.load(json).class.should == JSONSpecs::MyClass + }.should output_to_fd(warning, STDERR) JSON.parse(json).class.should == Hash JSON.parse(json, nil).class.should == Hash |