This project is archived and is in readonly mode.

#4927 ✓resolved
David Chelimsky

Support specifying locals with assert_template in view tests

Reported by David Chelimsky | June 22nd, 2010 @ 07:50 AM

I'd like to be able to specify the data that is passed to a partial by the template calling render. For example:

# in widgets index test
@widgets = [widget = mock]
render "widgets/index.html.erb"
assert_template :partial => "widgets/_widget", :locals => { :widget => widget }

# in widgets/index.html.erb
<% @widgets.each do |widget| -%>
  <%= render :partial => "widget", :locals => { :widget => widget } %>
<% end -%>

Patch forthcoming

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages