Skip to content

Commit

Permalink
spec/ruby/library/yaml: Test YAML.unsafe_load instead of YAML.load in…
Browse files Browse the repository at this point in the history
… 3.1
  • Loading branch information
mame authored and eregon committed Jun 2, 2021
1 parent 665b4d3 commit 14bfab6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/mspec/matchers/match_yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def clean_yaml(yaml)
def valid_yaml?(obj)
require 'yaml'
begin
YAML.load(obj)
if defined?(YAML.unsafe_load)
YAML.unsafe_load(obj)
else
YAML.load(obj)
end
rescue
false
else
Expand Down

0 comments on commit 14bfab6

Please sign in to comment.