Skip to content

Commit

Permalink
Autoload HTML::Document and sanitizers
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy committed Nov 24, 2008
1 parent fb4bb93 commit 2dd0ec4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -127,4 +124,4 @@ def assert_no_tag(*opts)
end
end
end
end
end
9 changes: 9 additions & 0 deletions actionpack/lib/action_controller/vendor/html-scanner.rb
Original file line number Diff line number Diff line change
@@ -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
11 changes: 1 addition & 10 deletions actionpack/lib/action_view/helpers/sanitize_helper.rb
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 0 additions & 10 deletions actionpack/lib/action_view/helpers/text_helper.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2dd0ec4

Please sign in to comment.