Skip to content

Commit

Permalink
Assert newly added warning in JSON.load
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu authored and eregon committed Nov 6, 2024
1 parent a230079 commit 6ff8a7e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion security/cve_2020_10663_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ def to_json(*args)

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
Expand Down

0 comments on commit 6ff8a7e

Please sign in to comment.