On Jun 13, 2010, at 5:32 PM, Kristian Mandrup <[email protected]> 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
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to