debian-mirror-gitlab/debian/gems-compat/actionpack-5.1.6.1/lib/action_dispatch/testing/assertions.rb

23 lines
614 B
Ruby
Raw Normal View History

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.to_s.end_with?("xml")
Nokogiri::XML::Document.parse(@response.body)
else
Nokogiri::HTML::Document.parse(@response.body)
end
end
end
end