From 49331ddec794834987ec5e7c4aa51264345a8ca0 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 7 May 2012 17:49:53 +0000 Subject: * lib/minitest/unit.rb (assert_match): refix of r35563. r35563 breaks the intention of the original change. https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3 * lib/minitest/unit.rb (refute_match): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/minitest/unit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/minitest') diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb index 707ec5e055..9d9439c552 100644 --- a/lib/minitest/unit.rb +++ b/lib/minitest/unit.rb @@ -282,7 +282,7 @@ module MiniTest def assert_match matcher, obj, msg = nil msg = message(msg) { "Expected #{mu_pp matcher} to match #{mu_pp obj}" } assert_respond_to obj, :"=~" - matcher = Regexp.new Regexp.escape matcher if String === matcher and String === obj + matcher = Regexp.new Regexp.escape matcher if String === matcher and obj.respond_to?(:to_str) assert matcher =~ obj, msg end @@ -583,7 +583,7 @@ module MiniTest def refute_match matcher, obj, msg = nil msg = message(msg) {"Expected #{mu_pp matcher} to not match #{mu_pp obj}"} assert_respond_to obj, :"=~" - matcher = Regexp.new Regexp.escape matcher if String === matcher and String === obj + matcher = Regexp.new Regexp.escape matcher if String === matcher and obj.respond_to?(:to_str) refute matcher =~ obj, msg end -- cgit v1.2.3