From 86a0f7f73594e5ba56b78b74c16cd6efa7e6cfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 10 May 2011 10:22:09 +0200 Subject: Add tests for content_for() for read, closes #475. --- actionpack/test/template/capture_helper_test.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'actionpack/test/template') 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, "

title

" - 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, "

title

".html_safe - assert_equal "hi

title

", @view_flow.get(:title) + assert_equal "hi

title

", content_for(:title) end def test_with_output_buffer_swaps_the_output_buffer_given_no_argument -- cgit v1.2.3