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
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to