From 2321ade41d9644207efb262137a3748b85b6c635 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 17 May 2021 20:12:39 +0200 Subject: [PATCH] Prefer respond_to? to defined? in MSpec --- spec/mspec/lib/mspec/matchers/match_yaml.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/mspec/lib/mspec/matchers/match_yaml.rb b/spec/mspec/lib/mspec/matchers/match_yaml.rb index 664ca73a7d..30561627c3 100644 --- a/spec/mspec/lib/mspec/matchers/match_yaml.rb +++ b/spec/mspec/lib/mspec/matchers/match_yaml.rb @@ -30,7 +30,7 @@ class MatchYAMLMatcher def valid_yaml?(obj) require 'yaml' begin - if defined?(YAML.unsafe_load) + if YAML.respond_to?(:unsafe_load) YAML.unsafe_load(obj) else YAML.load(obj)