[rspec-users] content_for

Carl-Johan Kihlbom
Tue, 05 Jun 2007 10:42:52 -0000

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