Permalink
Browse files

Apply [3359] to stable branch.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@3360 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent cf44803 commit 16a31ccd7d6471c8d0f1cdfbdf90945440f5a157 Scott Barron committed Dec 30, 2005
@@ -142,6 +142,7 @@ def simple_format(text)
# truncate(text, 15)
# end
def auto_link(text, link = :all, href_options = {}, &block)
+ return '' if text.blank?
case link
when :all then auto_link_urls(auto_link_email_addresses(text, &block), href_options, &block)
when :email_addresses then auto_link_email_addresses(text, &block)
@@ -152,6 +152,8 @@ def test_auto_linking
assert_equal %(<p>Go to #{link3_result}. seriously, #{link3_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link3_raw}. seriously, #{link3_raw}? i think I'll say hello to #{email_raw}. instead.</p>))
assert_equal %(<p>Link #{link4_result}</p>), auto_link("<p>Link #{link4_raw}</p>")
assert_equal %(<p>#{link4_result} Link</p>), auto_link("<p>#{link4_raw} Link</p>")
+ assert_equal '', auto_link(nil)
+ assert_equal '', auto_link('')
end
def test_auto_link_at_eol

0 comments on commit 16a31cc

Please sign in to comment.