aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-10-12 22:58:51 +0200
committerTimm <kaspth@gmail.com>2014-06-16 21:04:20 +0200
commit9efdffe437ef5ac7b4416a9b7ad180b1e5888e28 (patch)
tree067e2124f0a8f5610a6da8e0838e323d3a9a5771
parent50347b15fe610d5ad8a76a315b9eac7a6f538eb4 (diff)
downloadrails-9efdffe437ef5ac7b4416a9b7ad180b1e5888e28.tar.gz
rails-9efdffe437ef5ac7b4416a9b7ad180b1e5888e28.tar.bz2
rails-9efdffe437ef5ac7b4416a9b7ad180b1e5888e28.zip
Moved html_document to ActionDispatch::Assertions. Included the Rails::Dom::Testing::Assertions there as well.
-rw-r--r--actionpack/lib/action_controller/test_case.rb7
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions.rb13
2 files changed, 13 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 98ed1c2382..c307702f5d 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -684,14 +684,9 @@ module ActionController
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.
diff --git a/actionpack/lib/action_dispatch/testing/assertions.rb b/actionpack/lib/action_dispatch/testing/assertions.rb
index 5f923abbf9..44815a75a8 100644
--- a/actionpack/lib/action_dispatch/testing/assertions.rb
+++ b/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'
@@ -7,6 +10,14 @@ module ActionDispatch
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
-