diff options
author | Gonçalo Silva <goncalossilva@gmail.com> | 2011-04-17 17:08:49 +0100 |
---|---|---|
committer | Gonçalo Silva <goncalossilva@gmail.com> | 2011-04-17 17:08:49 +0100 |
commit | 1c2b2233c3a7ec76c0a0eddf5b8be45c489be133 (patch) | |
tree | 56f2b767c3a4f1f14c51606bf2cbb714a98c5f89 /actionpack/test/template/capture_helper_test.rb | |
parent | 8d558cb1b069410c8f693295c9c4e2ffc9661e06 (diff) | |
parent | b6843f22ac42b503f6b8ac00105ca0679049be7d (diff) | |
download | rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.tar.gz rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.tar.bz2 rails-1c2b2233c3a7ec76c0a0eddf5b8be45c489be133.zip |
Merge branch 'master' of https://github.com/rails/rails into performance_test
Diffstat (limited to 'actionpack/test/template/capture_helper_test.rb')
-rw-r--r-- | actionpack/test/template/capture_helper_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/actionpack/test/template/capture_helper_test.rb b/actionpack/test/template/capture_helper_test.rb index 03050485fa..a9a36e6e6b 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::OutputFlow.new end def test_capture_captures_the_temporary_output_buffer_in_its_block @@ -45,6 +45,20 @@ class CaptureHelperTest < ActionView::TestCase assert ! content_for?(:something_else) end + def test_provide + assert !content_for?(:title) + provide :title, "hi" + assert content_for?(:title) + assert_equal "hi", @_view_flow.get(:title) + provide :title, "<p>title</p>" + assert_equal "hi<p>title</p>", @_view_flow.get(: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) + end + def test_with_output_buffer_swaps_the_output_buffer_given_no_argument assert_nil @av.output_buffer buffer = @av.with_output_buffer do |