aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionview/lib/action_view/testing/assertions/selector.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionview/lib/action_view/testing/assertions/selector.rb b/actionview/lib/action_view/testing/assertions/selector.rb
index b53e0c1b55..fea07b2897 100644
--- a/actionview/lib/action_view/testing/assertions/selector.rb
+++ b/actionview/lib/action_view/testing/assertions/selector.rb
@@ -333,6 +333,7 @@ module ActionView
content_mismatch = nil
text_matches = equality_tests.has_key?(:text)
+ match_with = Regexp.new(match_with.to_s) unless match_with.is_a?(Regexp)
remaining = matches.reject do |match|
# Preserve markup with to_s for html elements
@@ -341,7 +342,7 @@ module ActionView
content.strip! unless NO_STRIP.include?(match.name)
content.sub!(/\A\n/, '') if text_matches && match.name == "textarea"
- next if match_with.is_a?(Regexp) ? (content =~ match_with) : (content == match_with.to_s)
+ next if content =~ match_with
content_mismatch ||= sprintf("<%s> expected but was\n<%s>.", match_with, content)
true
end