Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Support specifying locals with assert_template in view tests

#4927

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

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

State: resolved
Milestone: none
Assigned to: José Valim José Valim
Importance: Low

Activity

  1. David Chelimsky
  2. David Chelimsky
    David Chelimsky

    Patch is admittedly hack-ish, but per conversation we can not use the instrumentation that supplies the other data used by assert_template.

    Feel free to provide any additional direction if you'd like to see this work differently.

    June 22nd, 2010 @ 07:58 AM

  3. Repository
    Repository
    • State changed from new to resolved

    June 22nd, 2010 @ 01:51 PM

  4. Ryan Bigg
    Ryan Bigg
    • Importance changed from to Low

    Automatic cleanup of spam.

    October 11th, 2010 @ 10:55 AM