# Add this to the bottom of your test_helper.rb module HelpersSelectorAsssertions def assert_select_in(html, *args, &block) node = HTML::Document.new(html).root assert_select(*args.unshift(node), &block) end end ActionView::TestCase.send(:include, HelpersSelectorAsssertions)