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 &lt;<a href="mailto:ben@benmabey.com">ben@benmabey.com</a>&gt; 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>
&gt; I wanted to test that the links below were being rendered in the views.<br>
&gt;<br>
&gt; - content_for :sidebar do<br>
&gt; &nbsp; %ul.links<br>
&gt; &nbsp; &nbsp; %li= edit_link edit_admin_contact_url(@contact), &quot;Contact&quot;<br>
&gt;<br>
&gt;<br>
&gt; # view test<br>
&gt; &nbsp; &nbsp; it &quot;should have the correct side bar links&quot; do<br>
&gt; &nbsp; &nbsp; &nbsp; do_render<br>
&gt; &nbsp; &nbsp; &nbsp; response.should have_tag(&quot;ul.links&quot;) do<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; with_tag(&quot;a[href=?]&quot;, edit_admin_account_url(accounts(:test)))<br>
&gt; &nbsp; &nbsp; &nbsp; end<br>
&gt; &nbsp; &nbsp; end<br>
&gt;<br>
&gt; The above doesn&#39;t work. &nbsp;Just to make sure my tests weren&#39;t the issue I<br>
&gt; removed the content_for block and the tests then passed.<br>
&gt;<br>
&gt; Is there something extra that has to be done to get the content_for<br>
&gt; contents to be rendered?<br>
&gt;<br>
&gt; Thanks for the help.<br>
&gt;<br>
<br>
</div>Hey Chris,<br>
AFAIK you can&#39;t test content_for&#39;s in the view specs. &nbsp;Someone may want<br>
to correct me on that.<br>
<br>
I usually test content_for stuff in my stories. &nbsp;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>&quot;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.&quot;