From fad214b9e1c0a66f8fecde48fbd8d122e5c51e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Apr 2011 01:09:05 +0200 Subject: Initial work on fibered layout. --- actionpack/test/template/capture_helper_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/test/template/capture_helper_test.rb') diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index 03050485fa..ec252fa117 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -4,7 +4,7 @@ class CaptureHelperTest < ActionView::TestCase def setup super @av = ActionView::Base.new - @_content_for = Hash.new {|h,k| h[k] = "" } + @_view_flow = ActionView::Flow.new end def test_capture_captures_the_temporary_output_buffer_in_its_block -- cgit v1.2.3 From e30ca001efa861cc13259ca8287837174b24e679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Apr 2011 10:28:47 +0200 Subject: Yo dawg, I heard you like streaming. So I put a fiber, inside a block, inside a body, so you can stream. --- actionpack/test/template/capture_helper_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/test/template/capture_helper_test.rb') diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index ec252fa117..3ebcb8165f 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -4,7 +4,7 @@ class CaptureHelperTest < ActionView::TestCase def setup super @av = ActionView::Base.new - @_view_flow = ActionView::Flow.new + @_view_flow = ActionView::OutputFlow.new end def test_capture_captures_the_temporary_output_buffer_in_its_block -- cgit v1.2.3 From 29078ff8f1561420a405384772c051dc30bdcbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Apr 2011 10:50:33 +0200 Subject: Basic tests for streaming. Basic tests for provide. --- actionpack/test/template/capture_helper_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test/template/capture_helper_test.rb') diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index 3ebcb8165f..c2f0825375 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -45,6 +45,17 @@ class CaptureHelperTest < ActionView::TestCase assert ! content_for?(:something_else) end + def test_provide + assert !content_for?(:title) + provide :title, "title" + assert content_for?(:title) + assert_equal "title", @_view_flow.get(:title) + provide :title, "

title

" + assert_equal "<p>title</p>", @_view_flow.get(:title) + provide :title, "

title

".html_safe + assert_equal "

title

", @_view_flow.get(:title) + end + def test_with_output_buffer_swaps_the_output_buffer_given_no_argument assert_nil @av.output_buffer buffer = @av.with_output_buffer do -- cgit v1.2.3 From ab105e6072d291d7024e4e645defa5eff31f6f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Apr 2011 11:34:07 +0200 Subject: content_for should work with provide. --- actionpack/test/template/capture_helper_test.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'actionpack/test/template/capture_helper_test.rb') diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index c2f0825375..a9a36e6e6b 100644 --- a/actionpack/test/template/capture_helper_test.rb +++ b/actionpack/test/template/capture_helper_test.rb @@ -47,13 +47,16 @@ class CaptureHelperTest < ActionView::TestCase def test_provide assert !content_for?(:title) - provide :title, "title" + provide :title, "hi" assert content_for?(:title) - assert_equal "title", @_view_flow.get(:title) + assert_equal "hi", @_view_flow.get(:title) provide :title, "

title

" - assert_equal "<p>title</p>", @_view_flow.get(:title) + assert_equal "hi<p>title</p>", @_view_flow.get(:title) + + @_view_flow = ActionView::OutputFlow.new + provide :title, "hi" provide :title, "

title

".html_safe - assert_equal "

title

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

title

", @_view_flow.get(:title) end def test_with_output_buffer_swaps_the_output_buffer_given_no_argument -- cgit v1.2.3