Okay, I&#39;ll try that. Thanks.<br><br>I don&#39;t really like all the view stuff in the controllers, and I intend to eventually move them into RJS, but, while I&#39;m learning, I&#39;m keeping it there. :)<br><br>-Corey<br>
<br><div class="gmail_quote">On Feb 5, 2008 9:30 PM, David Chelimsky &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.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">On Feb 5, 2008 6:42 PM, Corey Haines &lt;<a href="mailto:coreyhaines@gmail.com">coreyhaines@gmail.com</a>&gt; wrote:<br></div><div class="Ih2E3d">&gt; David, I tried doing this, and I get an exception. Here&#39;s a pastie of the<br>
&gt; error, controller, controller_spec: <a href="http://pastie.caboo.se/148021" target="_blank">http://pastie.caboo.se/148021</a><br><br></div>You&#39;ve got page[:coupon_list], not just page. So what you need to mock is this:<br>
<br>page = mock(&quot;page&quot;)<br>page.should_receive(:[]).with(:coupon_list).and_return(page)<br>page.should_receive(:replace_html).with(:partial =&gt; &quot;coupon_list&quot;)<br><br>That&#39;s starting to get a bit brittle, but that&#39;s what you get for<br>
mixing all that view logic in your controllers. It&#39;s the Rails Way,<br>but it comes with a price if you want this level of coverage and<br>isolation.<br><br>FWIW,<br><font color="#888888">David<br></font><div><div></div>
<div class="Wj3C7c"><br>&gt;<br>&gt;<br>&gt;<br>&gt; On Feb 5, 2008 2:02 AM, David Chelimsky &lt;<a href="mailto:dchelimsky@gmail.com">dchelimsky@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt; &gt; it &quot;should replace foo with bar partial&quot; do<br>
&gt; &gt; &nbsp;page = mock(&quot;page&quot;)<br>&gt; &gt; &nbsp;page.should_receive(:replace_html).with(&#39;foo&#39;, :partial =&gt; &#39;bar&#39;)<br>&gt; &gt; &nbsp;controller.expect_render(:update).and_yield(page)<br>&gt; &gt; &nbsp;do_post<br>
&gt; &gt; end<br>&gt; &gt;<br>&gt; &gt; HTH,<br>&gt; &gt; David<br>&gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Brian<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; rspec-users mailing list<br>&gt; &gt; &gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; &gt; &gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
&gt; &gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; rspec-users mailing list<br>&gt; &gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; &gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
&gt; &gt;<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; <a href="http://www.coreyhaines.com" target="_blank">http://www.coreyhaines.com</a><br>&gt; The Internet&#39;s Premiere source of information about Corey Haines<br>&gt; _______________________________________________<br>
&gt; rspec-users mailing list<br>&gt; <a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>&gt; <a href="http://rubyforge.org/mailman/listinfo/rspec-users" target="_blank">http://rubyforge.org/mailman/listinfo/rspec-users</a><br>
&gt;<br>_______________________________________________<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><a href="http://www.coreyhaines.com">http://www.coreyhaines.com</a><br>The Internet&#39;s Premiere source of information about Corey Haines