diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-06 15:22:46 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-04-06 15:22:46 +0000 |
commit | 808d76a858712bab53f8fecb01694347ce6c1974 (patch) | |
tree | 02ffa4ebec481524a866eeb171a18d8b5e61b2fa | |
parent | 480150e5fb73f1a6a23bb08fdf9a537ccbd6f60d (diff) | |
download | rails-808d76a858712bab53f8fecb01694347ce6c1974.tar.gz rails-808d76a858712bab53f8fecb01694347ce6c1974.tar.bz2 rails-808d76a858712bab53f8fecb01694347ce6c1974.zip |
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
-rw-r--r-- | actionpack/test/template/text_helper_test.rb | 21 |
1 files changed, 17 insertions, 4 deletions
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 <a href="mailto:david@loudthinking.com">david@loudthinking.com</a>), auto_link("hello david@loudthinking.com", :email_addresses) - assert_equal %(Go to <a href="http://www.rubyonrails.com">http://www.rubyonrails.com</a>), 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 <a href="http://www.rubyonrails.com">http://www.rubyonrails.com</a> and say hello to <a href="mailto:david@loudthinking.com">david@loudthinking.com</a>), auto_link("Go to http://www.rubyonrails.com and say hello to david@loudthinking.com") + email_raw = 'david@loudthinking.com' + email_result = %{<a href="mailto:#{email_raw}">#{email_raw}</a>} + link_raw = 'http://www.rubyonrails.com' + link_result = %{<a href="#{link_raw}">#{link_raw}</a>} + link2_raw = 'www.rubyonrails.com' + link2_result = %{<a href="http://#{link2_raw}">#{link2_raw}</a>} + + 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 %(<p>Link #{link_result}</p>), auto_link("<p>Link #{link_raw}</p>") + assert_equal %(<p>#{link_result} Link</p>), auto_link("<p>#{link_raw} Link</p>") + 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 %(<p>Link #{link2_result}</p>), auto_link("<p>Link #{link2_raw}</p>") + assert_equal %(<p>#{link2_result} Link</p>), auto_link("<p>#{link2_raw} Link</p>") end end |