aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/text_helper_test.rb
diff options
context:
space:
mode:
authorrohit <rohit.arondekar@gmail.com>2010-06-08 12:33:55 +0530
committerJosé Valim <jose.valim@gmail.com>2010-06-08 09:11:34 +0200
commit67f411c57b98f926d39042ba003cefdba14be603 (patch)
tree81fd12fec50817ce1e81591ed39771511e6bfe78 /actionpack/test/template/text_helper_test.rb
parenta4eaa1fd39f93eff975bfd8a5cc4c7dfc3f18aa7 (diff)
downloadrails-67f411c57b98f926d39042ba003cefdba14be603.tar.gz
rails-67f411c57b98f926d39042ba003cefdba14be603.tar.bz2
rails-67f411c57b98f926d39042ba003cefdba14be603.zip
Fixed textilize_without_paragraph and added tests for it. [#4792 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/template/text_helper_test.rb')
-rw-r--r--actionpack/test/template/text_helper_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index 9d7106b2e5..8c4711451e 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -693,5 +693,37 @@ class TextHelperTest < ActionView::TestCase
def test_textilize_with_hard_breaks
assert_equal("<p>This is one scary world.<br />\n True.</p>", textilize("This is one scary world.\n True."))
end
+
+ def test_textilize_without_paragraph_should_be_html_safe
+ textilize_without_paragraph("*This is Textile!* Rejoice!").html_safe?
+ end
+
+ def test_textilize_without_paragraph
+ assert_equal("<strong>This is Textile!</strong> Rejoice!", textilize_without_paragraph("*This is Textile!* Rejoice!"))
+ end
+
+ def test_textilize_without_paragraph_with_blank
+ assert_equal("", textilize_without_paragraph(""))
+ end
+
+ def test_textilize_without_paragraph_with_options
+ assert_equal("This is worded &lt;strong&gt;strongly&lt;/strong&gt;", textilize_without_paragraph("This is worded <strong>strongly</strong>", :filter_html))
+ end
+
+ def test_textilize_without_paragraph_should_sanitize_unsafe_input
+ assert_equal("This is worded <strong>strongly</strong>", textilize_without_paragraph("This is worded <strong>strongly</strong><script>code!</script>"))
+ end
+
+ def test_textilize_without_paragraph_should_not_sanitize_input_if_safe_option
+ assert_equal("This is worded <strong>strongly</strong><script>code!</script>", textilize_without_paragraph("This is worded <strong>strongly</strong><script>code!</script>", :safe))
+ end
+
+ def test_textilize_without_paragraph_should_not_sanitize_safe_input
+ assert_equal("This is worded <strong>strongly</strong><script>code!</script>", textilize_without_paragraph("This is worded <strong>strongly</strong><script>code!</script>".html_safe))
+ end
+
+ def test_textilize_without_paragraph_with_hard_breaks
+ assert_equal("This is one scary world.<br />\n True.", textilize_without_paragraph("This is one scary world.\n True."))
+ end
end
end