How to test "content_for" chunks with functional tests?

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.


  • application.rhtml has stuff like “yield :title”, “yield :sidebar”,
  • views contain “content_for :title”, “content_for :sidebar”, etc.


  • 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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs