Browse files

Fix that RedCloth shouldn't be required to run tests

  • Loading branch information...
1 parent c41fb58 commit d44b5c6219bdf5c8d80fe2f2006541d22227a8f5 @jeremy jeremy committed Aug 9, 2009
Showing with 18 additions and 12 deletions.
  1. +18 −12 actionpack/test/template/text_helper_test.rb
View
30 actionpack/test/template/text_helper_test.rb
@@ -1,6 +1,10 @@
require 'abstract_unit'
require 'testing_sandbox'
-require 'redcloth'
+begin
+ require 'redcloth'
+rescue LoadError
+ $stderr.puts "Skipping textilize tests. `gem install RedCloth` to enable."
+end
class TextHelperTest < ActionView::TestCase
tests ActionView::Helpers::TextHelper
@@ -519,19 +523,21 @@ def test_cycle_no_instance_variable_clashes
assert_equal(%w{Specialized Fuji Giant}, @cycles)
end
- def test_textilize
- assert_equal("<p><strong>This is Textile!</strong> Rejoice!</p>", textilize("*This is Textile!* Rejoice!"))
- 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_blank
+ assert_equal("", textilize(""))
+ end
- def test_textilize_with_options
- assert_equal("<p>This is worded &lt;strong&gt;strongly&lt;/strong&gt;</p>", textilize("This is worded <strong>strongly</strong>", :filter_html))
- end
+ def test_textilize_with_options
+ assert_equal("<p>This is worded &lt;strong&gt;strongly&lt;/strong&gt;</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."))
+ 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

0 comments on commit d44b5c6

Please sign in to comment.