On Feb 5, 2008 6:42 PM, Corey Haines <[EMAIL PROTECTED]> wrote: > David, I tried doing this, and I get an exception. Here's a pastie of the > error, controller, controller_spec: http://pastie.caboo.se/148021
You've got page[:coupon_list], not just page. So what you need to mock is this: page = mock("page") page.should_receive(:[]).with(:coupon_list).and_return(page) page.should_receive(:replace_html).with(:partial => "coupon_list") That's starting to get a bit brittle, but that's what you get for mixing all that view logic in your controllers. It's the Rails Way, but it comes with a price if you want this level of coverage and isolation. FWIW, David > > > > On Feb 5, 2008 2:02 AM, David Chelimsky <[EMAIL PROTECTED]> wrote: > > > it "should replace foo with bar partial" do > > page = mock("page") > > page.should_receive(:replace_html).with('foo', :partial => 'bar') > > controller.expect_render(:update).and_yield(page) > > do_post > > end > > > > HTH, > > David > > > > > > > > Brian > > > > > > > > > _______________________________________________ > > > rspec-users mailing list > > > rspec-users@rubyforge.org > > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users@rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > > > -- > http://www.coreyhaines.com > The Internet's Premiere source of information about Corey Haines > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users