From bab54e4e529ae4d727fae8209ac60f9b25802680 Mon Sep 17 00:00:00 2001 From: Timm Date: Sat, 17 Aug 2013 11:24:40 +0200 Subject: [PATCH] Changed back to =~ or == comparison in HTMLSelector filter. --- actionview/lib/action_view/testing/assertions/selector.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actionview/lib/action_view/testing/assertions/selector.rb b/actionview/lib/action_view/testing/assertions/selector.rb index fea07b2897..d510ac2904 100644 --- a/actionview/lib/action_view/testing/assertions/selector.rb +++ b/actionview/lib/action_view/testing/assertions/selector.rb @@ -333,7 +333,7 @@ def filter(matches) content_mismatch = nil text_matches = equality_tests.has_key?(:text) - match_with = Regexp.new(match_with.to_s) unless match_with.is_a?(Regexp) + regex_matching = match_with.is_a?(Regexp) remaining = matches.reject do |match| # Preserve markup with to_s for html elements @@ -342,7 +342,7 @@ def filter(matches) content.strip! unless NO_STRIP.include?(match.name) content.sub!(/\A\n/, '') if text_matches && match.name == "textarea" - next if content =~ match_with + next if regex_matching ? (content =~ match_with) : (content == match_with) content_mismatch ||= sprintf("<%s> expected but was\n<%s>.", match_with, content) true end -- GitLab