Quick fix assert_select for XML testing
If you need this fix and don’t want to patch Rails directly, you can monkey patch Rails. But it’s a little tricky because the module is re-loaded during testing after
environment.rb is executed. Therefore, the usual method of putting a patch in
lib/ and requiring it from
environment.rb doesn’t work.
The patch is simply:
module ActionController::TestProcess def html_document xml = @response.content_type =~ /xml$/ @html_document ||= HTML::Document.new(@response.body, false, xml) end end
However it needs to be placed after the
require 'test_help' statement in
test/test_helper.rb or it will be overwritten.