diff options
author | Timm <kaspth@gmail.com> | 2013-10-12 22:58:51 +0200 |
---|---|---|
committer | Timm <kaspth@gmail.com> | 2014-06-16 21:04:20 +0200 |
commit | 9efdffe437ef5ac7b4416a9b7ad180b1e5888e28 (patch) | |
tree | 067e2124f0a8f5610a6da8e0838e323d3a9a5771 /actionpack | |
parent | 50347b15fe610d5ad8a76a315b9eac7a6f538eb4 (diff) | |
download | rails-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.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions.rb | 13 |
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 - |