From 808d76a858712bab53f8fecb01694347ce6c1974 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 6 Apr 2005 15:22:46 +0000 Subject: Fixed autolinking to work better in more cases #1013 [Jamis Buck] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1100 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/text_helper_test.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'actionpack') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 7a8c3cf0ae..fe170d6720 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -84,10 +84,23 @@ class TextHelperTest < Test::Unit::TestCase end def test_auto_linking - assert_equal %(hello david@loudthinking.com), auto_link("hello david@loudthinking.com", :email_addresses) - assert_equal %(Go to http://www.rubyonrails.com), auto_link("Go to http://www.rubyonrails.com", :urls) - assert_equal %(Go to http://www.rubyonrails.com), auto_link("Go to http://www.rubyonrails.com", :email_addresses) - assert_equal %(Go to http://www.rubyonrails.com and say hello to david@loudthinking.com), auto_link("Go to http://www.rubyonrails.com and say hello to david@loudthinking.com") + email_raw = 'david@loudthinking.com' + email_result = %{#{email_raw}} + link_raw = 'http://www.rubyonrails.com' + link_result = %{#{link_raw}} + link2_raw = 'www.rubyonrails.com' + link2_result = %{#{link2_raw}} + + assert_equal %(hello #{email_result}), auto_link("hello #{email_raw}", :email_addresses) + assert_equal %(Go to #{link_result}), auto_link("Go to #{link_raw}", :urls) + assert_equal %(Go to #{link_raw}), auto_link("Go to #{link_raw}", :email_addresses) + assert_equal %(Go to #{link_result} and say hello to #{email_result}), auto_link("Go to #{link_raw} and say hello to #{email_raw}") + assert_equal %(

Link #{link_result}

), auto_link("

Link #{link_raw}

") + assert_equal %(

#{link_result} Link

), auto_link("

#{link_raw} Link

") + assert_equal %(Go to #{link2_result}), auto_link("Go to #{link2_raw}", :urls) + assert_equal %(Go to #{link2_raw}), auto_link("Go to #{link2_raw}", :email_addresses) + assert_equal %(

Link #{link2_result}

), auto_link("

Link #{link2_raw}

") + assert_equal %(

#{link2_result} Link

), auto_link("

#{link2_raw} Link

") end end -- cgit v1.2.3