This project is archived and is in readonly mode.
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
-
David Chelimsky June 22nd, 2010 @ 07:54 AM
- Assigned user set to José Valim
-
David Chelimsky June 22nd, 2010 @ 07:58 AM
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.
-
Repository June 22nd, 2010 @ 01:51 PM
- State changed from new to resolved
(from [0576ec4ddd5f806c6ae98184d28391fc239db1ef]) Add support for specifying locals in view tests with assert template [#4927 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/0576ec4ddd5f806c6ae98184d28391... -
Ryan Bigg October 11th, 2010 @ 10:55 AM
- Importance changed from to Low
Automatic cleanup of spam.
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>
People watching this ticket
Referenced by
- 4927 Support specifying locals with assert_template in view tests (from [0576ec4ddd5f806c6ae98184d28391fc239db1ef]) Add sup...