# How to test "content\_for" chunks with functional tests?

**URL:** <https://www.ruby-forum.com/t/how-to-test-content-for-chunks-with-functional-tests/107124>\
**Category:** Rails\
**Created:** [June 18, 2007, 12:43pm UTC](https://www.ruby-forum.com/t/how-to-test-content-for-chunks-with-functional-tests/107124 "2007-06-18T12:43:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Null\_Null\_Dev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f08c70/32.png) [@Null\_Null\_Dev](https://www.ruby-forum.com/u/Null_Null_Dev)\
**Post date:** [June 18, 2007, 12:43pm UTC](https://www.ruby-forum.com/t/how-to-test-content-for-chunks-with-functional-tests/107124/1 "2007-06-18T12:43:43Z")

</div>

Basically, we have an application layout that demands some content  
for, e.g. the sidebar… during functional testing, we want to assert  
that our views properly provide this content.

Example:

- application.rhtml has stuff like “yield :title”, “yield :sidebar”,  
etc.
- views contain “content\_for :title”, “content\_for :sidebar”, etc.

Question:

- When writing functional tests, is there a way to test that the views  
properly call “content\_for :sidebar”, i.e. that “yield :sidebar” in  
the layout does not result in an empty string?

I’m rather new to Rails, just started using functional tests a few  
days ago… despite much searching, I couldn’t find a solution to the  
issues above.

Any hints are greatly appreciated. – Thanks!
