diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-10-08 15:05:18 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-10-08 15:05:18 -0300 |
commit | 0cf4662ec589813c4fdc22de3398730cab05c5ed (patch) | |
tree | d422b8d8e4ccccf9bd89443b82398e1d7313269f /actionpack/test/template/sanitize_helper_test.rb | |
parent | c3f9d51a00b9e7e5f5d14e7464fae04c48198756 (diff) | |
parent | 665c7ad29d5614b8f5535d317f1dd2803ddcaa7d (diff) | |
download | rails-0cf4662ec589813c4fdc22de3398730cab05c5ed.tar.gz rails-0cf4662ec589813c4fdc22de3398730cab05c5ed.tar.bz2 rails-0cf4662ec589813c4fdc22de3398730cab05c5ed.zip |
Merge commit 'rails/master'
Diffstat (limited to 'actionpack/test/template/sanitize_helper_test.rb')
-rw-r--r-- | actionpack/test/template/sanitize_helper_test.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/test/template/sanitize_helper_test.rb b/actionpack/test/template/sanitize_helper_test.rb index f715071bbc..222d4dbf4c 100644 --- a/actionpack/test/template/sanitize_helper_test.rb +++ b/actionpack/test/template/sanitize_helper_test.rb @@ -39,7 +39,16 @@ class SanitizeHelperTest < ActionView::TestCase %{This is a test.\n\n\nIt no longer contains any HTML.\n}, strip_tags( %{<title>This is <b>a <a href="" target="_blank">test</a></b>.</title>\n\n<!-- it has a comment -->\n\n<p>It no <b>longer <strong>contains <em>any <strike>HTML</strike></em>.</strong></b></p>\n})) assert_equal "This has a here.", strip_tags("This has a <!-- comment --> here.") - [nil, '', ' '].each { |blank| assert_equal blank, strip_tags(blank) } + [nil, '', ' '].each do |blank| + stripped = strip_tags(blank) + assert_equal blank, stripped + assert stripped.html_safe? unless blank.nil? + end + assert strip_tags("<script>").html_safe? + end + + def test_sanitize_is_marked_safe + assert sanitize("<html><script></script></html>").html_safe? end def assert_sanitized(text, expected = nil) |