rails/rails — Issue #3675: assert_template against the same partial with different locals
Author: luisobo
Created: 2011-11-18 11:29:37+00:00
State: open

I have a view like this

<%= render :partial => 'widget', :locals => { :param => "10" } %>
<%= render :partial => 'widget', :locals => { :param => "20" } %>

Then in RSpec I'm doing this:

rendered.should render_template :partial => 'widget', :locals => { :param => "10" }
rendered.should render_template :partial => 'widget', :locals => { :param => "20" }

The first expectation is failing. It says something like expected "10", found "20". It looks like it's only saving the last partial and checking all my expectations against the last one.

The second expectation is passing.

The RSpec matcher `render_template` uses `assert_template` so the problem is the same there.