Permalink
Browse files

Autoload HTML::Document and sanitizers

  • Loading branch information...
1 parent fb4bb93 commit 2dd0ec48a5068a095e362fad2a77d63b86fdfd95 @jeremy jeremy committed Nov 24, 2008
@@ -1,6 +1,3 @@
-require 'rexml/document'
-require 'html/document'
-
module ActionController
module Assertions
# A small suite of assertions that test responses from Rails applications.
@@ -3,8 +3,7 @@
# Under MIT and/or CC By license.
#++
-require 'rexml/document'
-require 'html/document'
+require 'action_controller/vendor/html-scanner'
module ActionController
module Assertions
@@ -1,6 +1,3 @@
-require 'rexml/document'
-require 'html/document'
-
module ActionController
module Assertions
# Pair of assertions to testing elements in the HTML output of the response.
@@ -127,4 +124,4 @@ def assert_no_tag(*opts)
end
end
end
-end
+end
@@ -0,0 +1,9 @@
+$LOAD_PATH << "#{File.dirname(__FILE__)}/html-scanner"
+
+module HTML
+ autoload :Document, 'html/document'
+ autoload :Sanitizer, 'html/sanitizer'
+ autoload :FullSanitizer, 'html/sanitizer'
+ autoload :LinkSanitizer, 'html/sanitizer'
+ autoload :WhiteListSanitizer, 'html/sanitizer'
+end
@@ -1,14 +1,5 @@
require 'action_view/helpers/tag_helper'
-
-begin
- require 'html/document'
-rescue LoadError
- html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner"
- if File.directory?(html_scanner_path)
- $:.unshift html_scanner_path
- require 'html/document'
- end
-end
+require 'action_controller/vendor/html-scanner'
module ActionView
module Helpers #:nodoc:
@@ -1,15 +1,5 @@
require 'action_view/helpers/tag_helper'
-begin
- require 'html/document'
-rescue LoadError
- html_scanner_path = "#{File.dirname(__FILE__)}/../../action_controller/vendor/html-scanner"
- if File.directory?(html_scanner_path)
- $:.unshift html_scanner_path
- require 'html/document'
- end
-end
-
module ActionView
module Helpers #:nodoc:
# The TextHelper module provides a set of methods for filtering, formatting

0 comments on commit 2dd0ec4

Please sign in to comment.