[rspec-users] content_for

Carl-Johan Kihlbom kihlbom at gmail.com
Tue Jun 5 06:42:52 EDT 2007


Okey, here's how I solved it:

In spec_helper.rb I defined the following method:

    def content_for(name)
      response.template.instance_variable_get("@content_for_#{name}")
    end

Then in my examples I can just use this:

    content_for(:sidebar).should have_tag('ul.people li.person', 2)

If anyone has a cleaner solution, please let me know.

/ CJ


More information about the rspec-users mailing list