From 4e9bc0f02ddd7d90740e289e565d7f4ebd6e2c1d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 26 Oct 2005 13:26:04 +0000 Subject: Added TextHelper#strip_tags for removing HTML tags from a string (using HTMLTokenizer) (closes #2229) [marcin@junkheap.net] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2750 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/text_helper_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index 3eb70eadae..ef6c837c9f 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -268,4 +268,13 @@ class TextHelperTest < Test::Unit::TestCase assert_equal(%w{Specialized Fuji Giant}, @cycles) end + def test_strip_tags + assert_equal("This is a test.", strip_tags("

This is a test.

")) + assert_equal("This is a test.", strip_tags("This is a test.")) + assert_equal( + %{This is a test.\n\n\nIt no longer contains any HTML.\n}, strip_tags( + %{This is <b>a <a href="" target="_blank">test</a></b>.\n\n\n\n

It no longer contains any HTML.

\n})) + assert_equal("This has a here.", strip_tags("This has a here.")) + end + end -- cgit v1.2.3