# File lib/rails/dom/testing/assertions/selector_assertions.rb, line 164
        def assert_select(*args, &block)
          @selected ||= nil

          selector = HTMLSelector.new(args, @selected) { nodeset document_root_element }

          if selecting_no_body?(selector)
            assert true
            return
          end

          selector.select.tap do |matches|
            assert_size_match!(matches.size, selector.tests, selector.selector, selector.message)

            nest_selection(matches, &block) if block_given? && !matches.empty?
          end
        rescue Nokogiri::CSS::SyntaxError => e
          ActiveSupport::Deprecation.warn("The assertion was not run because of an invalid css selector.\n#{e}", caller(2))
          return
        end