Sha256: c5fe3d802493f869ad78cc8c33bf9f8e14239cc74cda59bc4033f39dbd96eed5
Contents?: true
Size: 1.87 KB
Versions: 3
Compression:
Stored size: 1.87 KB
Contents
require File.expand_path('../unit_test_helper', __FILE__) class AutoHtmlTest < Test::Unit::TestCase def test_should_be_nil_no_filters_provided result = auto_html("Hey check out my blog => http://rors.org") { } assert_nil result end def test_should_apply_simple_format_filter result = auto_html("Hey check out my blog => http://rors.org") { simple_format } assert_equal "<p>Hey check out my blog => http://rors.org</p>", result end def test_should_apply_simple_format_and_image_filter result = auto_html("Check the logo: http://rors.org/images/rails.png") { simple_format; image } assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" alt=""/></p>', result end def test_should_apply_simple_format_image_and_link_filter result = auto_html("Check the logo: http://rors.org/images/rails.png. Visit: http://rubyonrails.org") { simple_format; image; link } assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" alt=""/>. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a></p>', result end def test_should_apply_simple_format_image_and_redcloth_and_link_filter result = auto_html('Check the logo: http://rors.org/images/rails.png. Visit: http://rubyonrails.org and "Read the Guides":http://guides.rubyonrails.org/') { simple_format; image; redcloth; link } assert_equal '<p>Check the logo: <img src="http://rors.org/images/rails.png" alt=""/>. Visit: <a href="http://rubyonrails.org">http://rubyonrails.org</a> and <a href="http://guides.rubyonrails.org/">Read the Guides</a></p>', result end def test_should_return_blank_if_input_is_blank result = auto_html("") { simple_format; image; link } assert_equal "", result end def test_should_not_apply_simple_format_if_input_is_nil result = auto_html(nil) { simple_format; image; link } assert_equal "", result end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
auto_html-1.3.7 | test/unit/auto_html_test.rb |
auto_html-1.3.6 | test/unit/auto_html_test.rb |
auto_html-1.3.5 | test/unit/auto_html_test.rb |