Module: ActionDispatch::Assertions

Includes:
ResponseAssertions, RoutingAssertions, Rails::Dom::Testing::Assertions
Included in:
Integration::Runner, Integration::Session, ActionView::TestCase::Behavior
Defined in:
actionpack/lib/action_dispatch/testing/assertions.rb,
actionpack/lib/action_dispatch/testing/assertions/routing.rb,
actionpack/lib/action_dispatch/testing/assertions/response.rb

Defined Under Namespace

Modules: ResponseAssertions, RoutingAssertions

Constant Summary

Constants included from ResponseAssertions

ResponseAssertions::RESPONSE_PREDICATES

Instance Method Summary collapse

Methods included from RoutingAssertions

#assert_generates, #assert_recognizes, #assert_routing, #method_missing, #setup, #with_routing

Methods included from ResponseAssertions

#assert_redirected_to, #assert_response

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActionDispatch::Assertions::RoutingAssertions

Instance Method Details

#html_documentObject



13
14
15
16
17
18
19
# File 'actionpack/lib/action_dispatch/testing/assertions.rb', line 13

def html_document
  @html_document ||= if @response.media_type&.end_with?("xml")
    Nokogiri::XML::Document.parse(@response.body)
  else
    Nokogiri::HTML::Document.parse(@response.body)
  end
end