1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_dispatch/testing/assertions.rb
Kasper Timm Hansen f939904f23 Parse HTML as document fragment.
This is to match the changes in Rails Dom Testing rails/rails-dom-testing#20.
2014-09-29 21:41:52 +02:00

22 lines
610 B
Ruby

require 'rails-dom-testing'
module ActionDispatch
module Assertions
autoload :ResponseAssertions, 'action_dispatch/testing/assertions/response'
autoload :RoutingAssertions, 'action_dispatch/testing/assertions/routing'
extend ActiveSupport::Concern
include ResponseAssertions
include RoutingAssertions
include Rails::Dom::Testing::Assertions
def html_document
@html_document ||= if @response.content_type =~ /xml$/
Nokogiri::XML::Document.parse(@response.body)
else
Nokogiri::HTML::DocumentFragment.parse(@response.body)
end
end
end
end