[rspec-users] undefined local variable or method `assigns'

Kristian Mandrup kmandrup at gmail.com
Tue Jun 15 01:17:07 EDT 2010


Thanks again David :) Pure magic to me, I don't really understand how/
why that makes it work. But it does!

On Jun 14, 2:30 am, David Chelimsky <dchelim... at gmail.com> wrote:
> On Jun 13, 2010, at 5:32 PM, Kristian Mandrup <kmand... at gmail.com>  
> wrote:
>
>
>
> > shared_examples_for "a template that renders the messages/form
> > partial" do
> >  it "renders the messages/form partial" do
> >    view.should_receive(:_render_partial).
> >      with(hash_including(:partial => "form"))
> >    render
> >  end
> > end
>
> > # new.html.erb
>
> > <%= render "sidebar", :recent_messages => @recent_messages %>
> > <%= render "form", :message => @message %>
>
> > 7) messages/new.html.erb renders the messages/form partial
> >    Failure/Error: Unable to find matching line from backtrace
> >    #<ActionView::Base:0x000001014fbc88> received :_render_partial
> > with unexpected arguments
> >      expected: (hash_including(:partial=>"form"))
> >           got:
> > ({:partial=>"sidebar", :locals=>{:recent_messages=>[]}})
>
> > So what to do if I call multiple partials from my view?
>
> view.stub(:_render_partial) before view.should_receive(:_render_partial)
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list