diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-10 10:22:09 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-10 10:22:09 +0200 |
commit | 86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9 (patch) | |
tree | 886a43eb4d2b590b13e4dec43b500022e7112448 /actionpack/test/template | |
parent | 3f36441e90d0930349186ca597c9884ff1d7fbdb (diff) | |
download | rails-86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9.tar.gz rails-86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9.tar.bz2 rails-86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9.zip |
Add tests for content_for() for read, closes #475.
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/capture_helper_test.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index 592c7da060..a9157e711c 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -38,7 +38,15 @@ class CaptureHelperTest < ActionView::TestCase assert_equal '<em>bar</em>', string end - def test_content_for + def test_capture_used_for_read + content_for :foo, "foo" + assert_equal "foo", content_for(:foo) + + content_for(:bar){ "bar" } + assert_equal "bar", content_for(:bar) + end + + def test_content_for_question_mark assert ! content_for?(:title) content_for :title, 'title' assert content_for?(:title) @@ -49,14 +57,14 @@ class CaptureHelperTest < ActionView::TestCase assert !content_for?(:title) provide :title, "hi" assert content_for?(:title) - assert_equal "hi", @view_flow.get(:title) + assert_equal "hi", content_for(:title) provide :title, "<p>title</p>" - assert_equal "hi<p>title</p>", @view_flow.get(:title) + assert_equal "hi<p>title</p>", content_for(:title) @view_flow = ActionView::OutputFlow.new provide :title, "hi" provide :title, "<p>title</p>".html_safe - assert_equal "hi<p>title</p>", @view_flow.get(:title) + assert_equal "hi<p>title</p>", content_for(:title) end def test_with_output_buffer_swaps_the_output_buffer_given_no_argument |