This might be of some use:<br><br><a href="http://rubyforge.org/pipermail/rspec-users/2007-June/001954.html">http://rubyforge.org/pipermail/rspec-users/2007-June/001954.html</a><br><br><div class="gmail_quote">On Sat, Apr 19, 2008 at 9:55 PM, Ben Mabey <<a href="mailto:ben@benmabey.com">ben@benmabey.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Chris Olsen wrote:<br>
> I wanted to test that the links below were being rendered in the views.<br>
><br>
> - content_for :sidebar do<br>
> %ul.links<br>
> %li= edit_link edit_admin_contact_url(@contact), "Contact"<br>
><br>
><br>
> # view test<br>
> it "should have the correct side bar links" do<br>
> do_render<br>
> response.should have_tag("ul.links") do<br>
> with_tag("a[href=?]", edit_admin_account_url(accounts(:test)))<br>
> end<br>
> end<br>
><br>
> The above doesn't work. Just to make sure my tests weren't the issue I<br>
> removed the content_for block and the tests then passed.<br>
><br>
> Is there something extra that has to be done to get the content_for<br>
> contents to be rendered?<br>
><br>
> Thanks for the help.<br>
><br>
<br>
</div>Hey Chris,<br>
AFAIK you can't test content_for's in the view specs. Someone may want<br>
to correct me on that.<br>
<br>
I usually test content_for stuff in my stories. If your not using<br>
stories then you could try integrating the views on certain controller<br>
specs and testing it there.<br>
<br>
Not the answer you were probably looking for, but I hope that helps.<br>
<font color="#888888"><br>
-Ben<br>
</font><div><div></div><div class="Wj3C7c">_______________________________________________<br>
rspec-users mailing list<br>
<a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Bryan Ray<br><a href="http://www.bryanray.net">http://www.bryanray.net</a><br><br>"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."