From 67f411c57b98f926d39042ba003cefdba14be603 Mon Sep 17 00:00:00 2001 From: rohit Date: Tue, 8 Jun 2010 12:33:55 +0530 Subject: Fixed textilize_without_paragraph and added tests for it. [#4792 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/test/template/text_helper_test.rb | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'actionpack/test/template/text_helper_test.rb') 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("

This is one scary world.
\n True.

", 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("This is Textile! 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 <strong>strongly</strong>", textilize_without_paragraph("This is worded strongly", :filter_html)) + end + + def test_textilize_without_paragraph_should_sanitize_unsafe_input + assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly")) + end + + def test_textilize_without_paragraph_should_not_sanitize_input_if_safe_option + assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly", :safe)) + end + + def test_textilize_without_paragraph_should_not_sanitize_safe_input + assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly".html_safe)) + end + + def test_textilize_without_paragraph_with_hard_breaks + assert_equal("This is one scary world.
\n True.", textilize_without_paragraph("This is one scary world.\n True.")) + end end end -- cgit v1.2.3