[rspec-users] Test if view renders appropriate partial?

David Chelimsky dchelimsky at gmail.com
Thu Apr 12 09:22:20 EDT 2007


On 4/12/07, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:
> On 4/12/07, Chris Hoffman <bosshoff at gmail.com> wrote:
> > Hello,
> >   I am testing out a partial that calls another, general purpose
> > partial as part of its processing.  Is there a class I can mock in
> > Rails views to accomplish what I need?  That is, could I do something
> > like the following:
> >
> > SomeClass.should_receive(:render).with(:partial => "foo", :locals => {
> > :bars => bars })
> >
> > I tried breakpointing the view, and it looks like I am greeted by an
> > anonymous class, which I am unsure how to mock.  Thanks for the help.
> >
>
> Do you mean like this?
> http://jakescruggs.blogspot.com/2007/04/stubbingmocking-partial-within-partial.html

Much better than what I proposed!

>
> > -Chris
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list