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