2013-10-12 16:58:51 -04:00
|
|
|
require 'rails-dom-testing'
|
|
|
|
|
2009-04-30 12:55:53 -04:00
|
|
|
module ActionDispatch
|
|
|
|
module Assertions
|
2009-11-09 22:37:37 -05:00
|
|
|
autoload :ResponseAssertions, 'action_dispatch/testing/assertions/response'
|
|
|
|
autoload :RoutingAssertions, 'action_dispatch/testing/assertions/routing'
|
|
|
|
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2011-05-23 02:13:44 -04:00
|
|
|
include ResponseAssertions
|
|
|
|
include RoutingAssertions
|
2013-10-12 16:58:51 -04:00
|
|
|
include Rails::Dom::Testing::Assertions
|
|
|
|
|
|
|
|
def html_document
|
2015-10-22 07:33:32 -04:00
|
|
|
@html_document ||= if @response.content_type.to_s =~ /xml\z/
|
2014-07-15 12:30:28 -04:00
|
|
|
Nokogiri::XML::Document.parse(@response.body)
|
2013-10-12 16:58:51 -04:00
|
|
|
else
|
2014-11-18 15:47:22 -05:00
|
|
|
Nokogiri::HTML::Document.parse(@response.body)
|
2013-10-12 16:58:51 -04:00
|
|
|
end
|
|
|
|
end
|
2009-04-30 12:55:53 -04:00
|
|
|
end
|
|
|
|
end
|