aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-15 13:30:28 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-07-15 13:40:21 -0300
commit158a6dfcd28e8b59ff656fc78856e623b7c0f799 (patch)
tree379379846c41ddc29db4bed1a074e520451c025a
parent126a15e0fe6a0021dd8bc37d32a2498a9c22cafd (diff)
downloadrails-158a6dfcd28e8b59ff656fc78856e623b7c0f799.tar.gz
rails-158a6dfcd28e8b59ff656fc78856e623b7c0f799.tar.bz2
rails-158a6dfcd28e8b59ff656fc78856e623b7c0f799.zip
We don't need loofah for the assertions
We can just use nokogiri
-rw-r--r--actionpack/lib/action_controller/test_case.rb1
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions.rb5
-rw-r--r--actionpack/test/controller/integration_test.rb6
-rw-r--r--actionview/lib/action_view/test_case.rb3
-rw-r--r--actionview/test/template/form_tag_helper_test.rb2
5 files changed, 7 insertions, 10 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index e8c570d68f..4c237b15a4 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -3,7 +3,6 @@ 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
diff --git a/actionpack/lib/action_dispatch/testing/assertions.rb b/actionpack/lib/action_dispatch/testing/assertions.rb
index 44815a75a8..f325c35b57 100644
--- a/actionpack/lib/action_dispatch/testing/assertions.rb
+++ b/actionpack/lib/action_dispatch/testing/assertions.rb
@@ -1,4 +1,3 @@
-require 'loofah'
require 'rails-dom-testing'
module ActionDispatch
@@ -14,9 +13,9 @@ module ActionDispatch
def html_document
@html_document ||= if @response.content_type =~ /xml$/
- Loofah.xml_document(@response.body)
+ Nokogiri::XML::Document.parse(@response.body)
else
- Loofah.document(@response.body)
+ Nokogiri::HTML::Document.parse(@response.body)
end
end
end
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index f509426040..2cd32ef85a 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -291,7 +291,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
assert_equal({}, cookies.to_hash)
assert_equal "OK", body
assert_equal "OK", response.body
- assert_kind_of Loofah::HTML::Document, html_document
+ assert_kind_of Nokogiri::HTML::Document, html_document
assert_equal 1, request_count
end
end
@@ -307,7 +307,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
assert_equal({}, cookies.to_hash)
assert_equal "Created", body
assert_equal "Created", response.body
- assert_kind_of Loofah::HTML::Document, html_document
+ assert_kind_of Nokogiri::HTML::Document, html_document
assert_equal 1, request_count
end
end
@@ -367,7 +367,7 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
assert_response :redirect
assert_response :found
assert_equal "<html><body>You are being <a href=\"http://www.example.com/get\">redirected</a>.</body></html>", response.body
- assert_kind_of Loofah::HTML::Document, html_document
+ assert_kind_of Nokogiri::HTML::Document, html_document
assert_equal 1, request_count
follow_redirect!
diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb
index 2d54b90570..4c65860423 100644
--- a/actionview/lib/action_view/test_case.rb
+++ b/actionview/lib/action_view/test_case.rb
@@ -3,7 +3,6 @@ require 'action_controller'
require 'action_controller/test_case'
require 'action_view'
-require 'loofah'
require 'rails-dom-testing'
module ActionView
@@ -159,7 +158,7 @@ module ActionView
# Need to experiment if this priority is the best one: rendered => output_buffer
def document_root_element
- @html_document ||= Loofah.document(@rendered.blank? ? @output_buffer : @rendered)
+ @html_document ||= Nokogiri::HTML::Document.parse(@rendered.blank? ? @output_buffer : @rendered)
@html_document.root
end
diff --git a/actionview/test/template/form_tag_helper_test.rb b/actionview/test/template/form_tag_helper_test.rb
index d5976905c5..771e3fefc3 100644
--- a/actionview/test/template/form_tag_helper_test.rb
+++ b/actionview/test/template/form_tag_helper_test.rb
@@ -632,6 +632,6 @@ class FormTagHelperTest < ActionView::TestCase
private
def root_elem(rendered_content)
- Loofah.fragment(rendered_content).children.first # extract from nodeset
+ Nokogiri::HTML::DocumentFragment.parse(rendered_content).children.first # extract from nodeset
end
end