From a53372c273a06681c3e4e51faa5b0f7757d35d0b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 2 Jul 2005 06:46:41 +0000 Subject: Added that UrlHelper#mail_to will now also encode the default link title #749 [f.svehla@gmail.com] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1601 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/active_record_helper_test.rb | 6 +++--- actionpack/test/template/form_helper_test.rb | 12 ++++++------ actionpack/test/template/url_helper_test.rb | 8 ++++++++ 3 files changed, 17 insertions(+), 9 deletions(-) (limited to 'actionpack/test') diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb index a57df0d031..853f37660f 100644 --- a/actionpack/test/template/active_record_helper_test.rb +++ b/actionpack/test/template/active_record_helper_test.rb @@ -65,7 +65,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase def test_text_area_with_errors assert_equal( - %(
), + %(
), text_area("post", "body") ) end @@ -79,7 +79,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase def test_form_with_string assert_equal( - %(


\n


), + %(


\n


), form("post") ) @@ -89,7 +89,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase def id() 1 end end assert_equal( - %(


\n


), + %(


\n


), form("post") ) end diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 4e1af744b5..b76f21d80b 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -100,7 +100,7 @@ class FormHelperTest < Test::Unit::TestCase def test_text_area assert_equal( - '', + '', text_area("post", "body") ) end @@ -108,14 +108,14 @@ class FormHelperTest < Test::Unit::TestCase def test_text_area_with_escapes @post.body = "Back to the hill and over it again!" assert_equal( - '', + '', text_area("post", "body") ) end def test_date_selects assert_equal( - '', + '', text_area("post", "body") ) end @@ -125,7 +125,7 @@ class FormHelperTest < Test::Unit::TestCase '', text_field("post", "title", "name" => "dont guess") ) assert_equal( - '', + '', text_area("post", "body", "name" => "really!") ) assert_equal( @@ -145,7 +145,7 @@ class FormHelperTest < Test::Unit::TestCase '', text_field("post", "title", "id" => "dont guess") ) assert_equal( - '', + '', text_area("post", "body", "id" => "really!") ) assert_equal( @@ -166,7 +166,7 @@ class FormHelperTest < Test::Unit::TestCase "", text_field("post[]","title") ) assert_equal( - "", + "", text_area("post[]", "body") ) assert_equal( diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index f208466118..0b75528176 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -116,6 +116,14 @@ class UrlHelperTest < Test::Unit::TestCase assert_equal "My email", mail_to("me@domain.com", "My email", :encode => "hex") end + def test_mail_to_with_replace_options + assert_equal "wolfgang(at)stufenlos(dot)net", mail_to("wolfgang@stufenlos.net", nil, :replace_at => "(at)", :replace_dot => "(dot)") + assert_equal "me(at)domain.com", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)") + assert_equal "My email", mail_to("me@domain.com", "My email", :encode => "hex", :replace_at => "(at)") + assert_equal "me(at)domain(dot)com", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)", :replace_dot => "(dot)") + assert_equal "", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") + end + def test_link_with_nil_html_options assert_equal "Hello", link_to("Hello", {:action => 'myaction'}, nil) end -- cgit v1.2.3