mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
e4ba720c17
We should be asking the mime type method for the mime objects rather than via const lookup
22 lines
613 B
Ruby
22 lines
613 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 === Mime::Type[:XML]
|
|
Nokogiri::XML::Document.parse(@response.body)
|
|
else
|
|
Nokogiri::HTML::Document.parse(@response.body)
|
|
end
|
|
end
|
|
end
|
|
end
|