diff --git a/lib/rails/dom/testing/assertions/selector_assertions.rb b/lib/rails/dom/testing/assertions/selector_assertions.rb index dab6233..c86b53a 100644 --- a/lib/rails/dom/testing/assertions/selector_assertions.rb +++ b/lib/rails/dom/testing/assertions/selector_assertions.rb @@ -275,7 +275,7 @@ def document_root_element def assert_size_match!(size, equals, css_selector, message = nil) min, max, count = equals[:minimum], equals[:maximum], equals[:count] - message ||= %(Expected #{count_description(min, max, count)} matching "#{css_selector}", found #{size}.) + message ||= %(Expected #{count_description(min, max, count)} matching #{css_selector.inspect}, found #{size}) if count assert_equal count, size, message else diff --git a/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb b/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb index 7e927ce..1f9facf 100644 --- a/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb +++ b/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb @@ -4,6 +4,8 @@ class HTMLSelector #:nodoc: attr_reader :css_selector, :tests, :message + include Minitest::Assertions + def initialize(values, previous_selection = nil, &root_fallback) @values = values @root = extract_root(previous_selection, root_fallback) @@ -52,7 +54,7 @@ def filter(matches) content.sub!(/\A\n/, '') if text_matches && match.name == "textarea" next if regex_matching ? (content =~ match_with) : (content == match_with) - content_mismatch ||= sprintf("<%s> expected but was\n<%s>", match_with, content) + content_mismatch ||= diff(match_with, content) true end