Skip to content

Commit

Permalink
Moved html_document to ActionDispatch::Assertions. Included the Rails…
Browse files Browse the repository at this point in the history
…::Dom::Testing::Assertions there as well.
  • Loading branch information
kaspth committed Jun 16, 2014
1 parent 50347b1 commit 9efdffe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 1 addition & 6 deletions actionpack/lib/action_controller/test_case.rb
Expand Up @@ -684,14 +684,9 @@ def build_response(klass)
private

def document_root_element
@html_document ||= if @response.content_type =~ /xml$/
Loofah.xml_document(@response.body)
else
Loofah.document(@response.body)
end.root
html_document.root
end


def check_required_ivars
# Sanity check for required instance variables so we can give an
# understandable error message.
Expand Down
13 changes: 12 additions & 1 deletion actionpack/lib/action_dispatch/testing/assertions.rb
@@ -1,3 +1,6 @@
require 'loofah'
require 'rails-dom-testing'

module ActionDispatch
module Assertions
autoload :ResponseAssertions, 'action_dispatch/testing/assertions/response'
Expand All @@ -7,6 +10,14 @@ module Assertions

include ResponseAssertions
include RoutingAssertions
include Rails::Dom::Testing::Assertions

def html_document
@html_document ||= if @response.content_type =~ /xml$/
Loofah.xml_document(@response.body)
else
Loofah.document(@response.body)
end
end
end
end

0 comments on commit 9efdffe

Please sign in to comment.