mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Moved html_document to ActionDispatch::Assertions. Included the Rails::Dom::Testing::Assertions there as well.
This commit is contained in:
parent
50347b15fe
commit
9efdffe437
2 changed files with 13 additions and 7 deletions
|
@ -684,14 +684,9 @@ module ActionController
|
||||||
private
|
private
|
||||||
|
|
||||||
def document_root_element
|
def document_root_element
|
||||||
@html_document ||= if @response.content_type =~ /xml$/
|
html_document.root
|
||||||
Loofah.xml_document(@response.body)
|
|
||||||
else
|
|
||||||
Loofah.document(@response.body)
|
|
||||||
end.root
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def check_required_ivars
|
def check_required_ivars
|
||||||
# Sanity check for required instance variables so we can give an
|
# Sanity check for required instance variables so we can give an
|
||||||
# understandable error message.
|
# understandable error message.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
require 'loofah'
|
||||||
|
require 'rails-dom-testing'
|
||||||
|
|
||||||
module ActionDispatch
|
module ActionDispatch
|
||||||
module Assertions
|
module Assertions
|
||||||
autoload :ResponseAssertions, 'action_dispatch/testing/assertions/response'
|
autoload :ResponseAssertions, 'action_dispatch/testing/assertions/response'
|
||||||
|
@ -7,6 +10,14 @@ module ActionDispatch
|
||||||
|
|
||||||
include ResponseAssertions
|
include ResponseAssertions
|
||||||
include RoutingAssertions
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue