diff options
Diffstat (limited to 'actionpack/test/template/text_helper_test.rb')
-rw-r--r-- | actionpack/test/template/text_helper_test.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 706b5085f4..08143ba680 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -1,5 +1,10 @@ require 'abstract_unit' require 'testing_sandbox' +begin + require 'redcloth' +rescue LoadError + $stderr.puts "Skipping textilize tests. `gem install RedCloth` to enable." +end class TextHelperTest < ActionView::TestCase tests ActionView::Helpers::TextHelper @@ -528,4 +533,22 @@ class TextHelperTest < ActionView::TestCase assert_equal("red", cycle("red", "blue")) assert_equal(%w{Specialized Fuji Giant}, @cycles) end + + if defined? RedCloth + def test_textilize + assert_equal("<p><strong>This is Textile!</strong> Rejoice!</p>", textilize("*This is Textile!* Rejoice!")) + end + + def test_textilize_with_blank + assert_equal("", textilize("")) + end + + def test_textilize_with_options + assert_equal("<p>This is worded <strong>strongly</strong></p>", textilize("This is worded <strong>strongly</strong>", :filter_html)) + end + + 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 + end end |