diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-07 08:09:06 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-07 08:09:06 +0000 |
commit | 3a62e0e868c8bf8e2c9312b4610ee057d514f038 (patch) | |
tree | 4cc3def13f0a9af21f2febcb325255fa28599365 /actionpack/test | |
parent | 008becb5a26b4549cf958ecf389c37284b4685ba (diff) | |
download | rails-3a62e0e868c8bf8e2c9312b4610ee057d514f038.tar.gz rails-3a62e0e868c8bf8e2c9312b4610ee057d514f038.tar.bz2 rails-3a62e0e868c8bf8e2c9312b4610ee057d514f038.zip |
Ruby 1.9 compat: check dom equality
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8587 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/html-scanner/sanitizer_test.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/test/controller/html-scanner/sanitizer_test.rb b/actionpack/test/controller/html-scanner/sanitizer_test.rb index a2f28eb5cf..db142f0bc6 100644 --- a/actionpack/test/controller/html-scanner/sanitizer_test.rb +++ b/actionpack/test/controller/html-scanner/sanitizer_test.rb @@ -240,15 +240,19 @@ class SanitizerTest < Test::Unit::TestCase end def test_should_sanitize_img_vbscript - assert_sanitized %(<img src='vbscript:msgbox("XSS")' />), '<img />' + assert_sanitized %(<img src='vbscript:msgbox("XSS")' />), '<img />' end protected def assert_sanitized(input, expected = nil) @sanitizer ||= HTML::WhiteListSanitizer.new - assert_equal expected || input, @sanitizer.sanitize(input) + if input + assert_dom_equal expected || input, @sanitizer.sanitize(input) + else + assert_nil @sanitizer.sanitize(input) + end end - + def sanitize_css(input) (@sanitizer ||= HTML::WhiteListSanitizer.new).sanitize_css(input) end |