Corey Haines wrote:
> Stub out the first one, something like
> 
> template.stub!(:render)
> 
> Then, each of your tests set the actual should_receive expectation.
> 
> -Corey
> 
> On Fri, Mar 14, 2008 at 8:44 AM, Alan Larkin <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     I'm trying to specify that a particular view must render two
>     different partials.
>     My spec looks like:
> 
>     describe AClass do
>       it do
>         template.should_receive(:render).with(:partial => 'foo', :locals
>     => { ... })
>         ...
>       end
> 
>       describe 'some conditional case' do
>         it do
>           template.should_receive(:render).with(:partial => 'bar',
>     :locals => { ... })
>           ...
>         end
>       end
>     end
> 
>     Rendering the foo partial passes off fine, but the spec fails when
>     it comes to
>     rendering the bar partial:
> 
>     Mock 'ActionView::Base' expected :render with ({:partial=>"bar",
>     :locals=>{...}}) but received it with ({:partial=>"foo",
>     :locals=>{...}})
> 
>     In the view the foo partial is rendered first, and presumably that
>     is being
>     intercepted in the second example and thus failing. How do I avoid this?
>     _______________________________________________
>     rspec-users mailing list
>     rspec-users@rubyforge.org <mailto: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

Thanks.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to