Skip to content
Browse files

Improve content_for test coverage

  • Loading branch information...
1 parent 8b049a1 commit b14902150bca306e337914e0171c2140f257e8c2 @tomstuart tomstuart committed Sep 1, 2011
Showing with 28 additions and 0 deletions.
  1. +28 −0 actionpack/test/template/capture_helper_test.rb
View
28 actionpack/test/template/capture_helper_test.rb
@@ -46,6 +46,34 @@ def test_capture_used_for_read
assert_equal "bar", content_for(:bar)
end
+ def test_content_for_with_multiple_calls
+ assert ! content_for?(:title)
+ content_for :title, 'foo'
+ content_for :title, 'bar'
+ assert_equal 'foobar', content_for(:title)
+ end
+
+ def test_content_for_with_block
+ assert ! content_for?(:title)
+ content_for :title do
+ output_buffer << 'foo'
+ output_buffer << 'bar'
+ nil
+ end
+ assert_equal 'foobar', content_for(:title)
+ end
+
+ def test_content_for_with_whitespace_block
+ assert ! content_for?(:title)
+ content_for :title, 'foo'
+ content_for :title do
+ output_buffer << " \n "
+ nil
+ end
+ content_for :title, 'bar'
+ assert_equal 'foobar', content_for(:title)
+ end
+
def test_content_for_question_mark
assert ! content_for?(:title)
content_for :title, 'title'

0 comments on commit b149021

Please sign in to comment.
Something went wrong with that request. Please try again.