aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorTimm <kaspth@gmail.com>2013-10-11 23:29:08 +0200
committerTimm <kaspth@gmail.com>2014-06-16 21:04:19 +0200
commit83f1563ee6cae34447b4ed12f8cf39cc15177a38 (patch)
tree661239e9dd9dc95fb9d662b87d905ac329c8767c /actionpack
parent28fd5ebd2e6b46ba7f2b7b138124d240245417e8 (diff)
downloadrails-83f1563ee6cae34447b4ed12f8cf39cc15177a38.tar.gz
rails-83f1563ee6cae34447b4ed12f8cf39cc15177a38.tar.bz2
rails-83f1563ee6cae34447b4ed12f8cf39cc15177a38.zip
Support for changes in SelectorAssertions.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/test_case.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index e6695ffc90..98ed1c2382 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -3,6 +3,9 @@ require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/module/anonymous'
require 'active_support/core_ext/hash/keys'
+require 'loofah'
+require 'rails-dom-testing'
+
module ActionController
module TemplateAssertions
extend ActiveSupport::Concern
@@ -432,6 +435,7 @@ module ActionController
extend ActiveSupport::Concern
include ActionDispatch::TestProcess
include ActiveSupport::Testing::ConstantLookup
+ include Rails::Dom::Testing::Assertions
attr_reader :response, :request
@@ -678,6 +682,16 @@ module ActionController
end
private
+
+ def document_root_element
+ @html_document ||= if @response.content_type =~ /xml$/
+ Loofah.xml_document(@response.body)
+ else
+ Loofah.document(@response.body)
+ end.root
+ end
+
+
def check_required_ivars
# Sanity check for required instance variables so we can give an
# understandable error message.