From adba18106081f55f2e8761b5104d295cacd6a8c6 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 10 Nov 2005 06:04:50 +0000 Subject: The auto_link text helper accepts an optional block to format the link text for each url and email address. References #2628. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2963 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/text_helper_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index ef6c837c9f..d43bc43b9c 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -161,6 +161,13 @@ class TextHelperTest < Test::Unit::TestCase assert_equal %(

#{url1}
#{url2}

), auto_link("

#{url1}
#{url2}

") end + def test_auto_link_with_block + url = "http://api.rubyonrails.com/Foo.html" + email = "fantabulous@shiznadel.ic" + + assert_equal %(

#{url[0..7]}...
#{email[0..7]}...

), auto_link("

#{url}
#{email}

") { |url| truncate(url, 10) } + end + def test_sanitize_form raw = "
" result = sanitize(raw) -- cgit v1.2.3