diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-10-23 22:57:59 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-10-23 22:57:59 +0000 |
commit | 6c062054cdb236fead5d09679985ebb70d8b053a (patch) | |
tree | fc50fc2b66a928c89f1e009b060952d459546a58 /actionpack/test | |
parent | 9c9443812f1274667cea14edd387c6124205ac1c (diff) | |
download | rails-6c062054cdb236fead5d09679985ebb70d8b053a.tar.gz rails-6c062054cdb236fead5d09679985ebb70d8b053a.tar.bz2 rails-6c062054cdb236fead5d09679985ebb70d8b053a.zip |
Added block-usage to TagHelper#content_tag [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5344 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/tag_helper_test.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb index bda57c4e9b..0ebdf009c7 100644 --- a/actionpack/test/template/tag_helper_test.rb +++ b/actionpack/test/template/tag_helper_test.rb @@ -1,11 +1,10 @@ require File.dirname(__FILE__) + '/../abstract_unit' -require File.dirname(__FILE__) + '/../../lib/action_view/helpers/tag_helper' -require File.dirname(__FILE__) + '/../../lib/action_view/helpers/url_helper' - class TagHelperTest < Test::Unit::TestCase include ActionView::Helpers::TagHelper include ActionView::Helpers::UrlHelper + include ActionView::Helpers::TextHelper + include ActionView::Helpers::CaptureHelper def test_tag assert_equal "<p class=\"show\" />", tag("p", "class" => "show") @@ -35,6 +34,18 @@ class TagHelperTest < Test::Unit::TestCase content_tag("a", "Create", :href => "create") end + def test_content_tag_with_block + _erbout = '' + content_tag(:div) { _erbout.concat "Hello world!" } + assert_dom_equal "<div>Hello world!</div>", _erbout + end + + def test_content_tag_with_block_and_options + _erbout = '' + content_tag(:div, :class => "green") { _erbout.concat "Hello world!" } + assert_dom_equal %(<div class="green">Hello world!</div>), _erbout + end + def test_cdata_section assert_equal "<![CDATA[<hello world>]]>", cdata_section("<hello world>") end |