aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2005-09-26 20:49:52 +0000
committerMarcel Molina <marcel@vernix.org>2005-09-26 20:49:52 +0000
commitb54560600b06112723adf286141a9cd7ed67b638 (patch)
tree07de49d0f78dbd5648af32e5d1abd656163a5e63 /actionpack/test
parentbbfde01b944eecee9f51cb54d6452e6685d82b73 (diff)
downloadrails-b54560600b06112723adf286141a9cd7ed67b638.tar.gz
rails-b54560600b06112723adf286141a9cd7ed67b638.tar.bz2
rails-b54560600b06112723adf286141a9cd7ed67b638.zip
Have text helpers use built in Regexp.escape rather than home grown alternative
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2350 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/text_helper_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index 856c32c300..3eb70eadae 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -100,7 +100,13 @@ class TextHelperTest < Test::Unit::TestCase
assert_equal("...iful morning", excerpt("This is a beautiful morning", "morning", 5))
assert_nil excerpt("This is a beautiful morning", "day")
end
+
+ def test_excerpt_with_regex
+ assert_equal('...is a beautiful! morn...', excerpt('This is a beautiful! morning', 'beautiful', 5))
+ assert_equal('...is a beautiful? morn...', excerpt('This is a beautiful? morning', 'beautiful', 5))
+ end
+
def test_word_wrap
assert_equal("my very very\nvery long\nstring", word_wrap("my very very very long string", 15))
end