From 83f1563ee6cae34447b4ed12f8cf39cc15177a38 Mon Sep 17 00:00:00 2001 From: Timm Date: Fri, 11 Oct 2013 23:29:08 +0200 Subject: Support for changes in SelectorAssertions. --- actionpack/lib/action_controller/test_case.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actionpack') 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. -- cgit v1.2.3