diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-04-26 20:47:22 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-04-29 14:45:06 -0300 |
commit | 0568fb5b9efa6923e9407552aae46b0a1210539d (patch) | |
tree | 986a02b68834fd100b0ece552088f6e00f6a6b3e /actionpack/test/template | |
parent | d0c9c93c4a3a7da27ab8d9f53811960309f8e18f (diff) | |
download | rails-0568fb5b9efa6923e9407552aae46b0a1210539d.tar.gz rails-0568fb5b9efa6923e9407552aae46b0a1210539d.tar.bz2 rails-0568fb5b9efa6923e9407552aae46b0a1210539d.zip |
Allow access to current object_counter variable from layout when rendering with partial + collection
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/render_test.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index a76526f946..cdaca56ef2 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -238,12 +238,19 @@ module RenderTestCases assert_equal "<b>Hello: Amazon</b><b>Hello: Yahoo</b>", @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial', :collection => [ Customer.new("Amazon"), Customer.new("Yahoo") ]) end - def test_render_partial_with_layout_using_collection_and_template_makes_current_item_available_in_template - assert_equal '<b class="amazon">Hello: Amazon</b><b class="yahoo">Hello: Yahoo</b>', @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial_with_object', :collection => [ Customer.new("Amazon"), Customer.new("Yahoo") ]) + def test_render_partial_with_layout_using_collection_and_template_makes_current_item_available_in_layout + assert_equal '<b class="amazon">Hello: Amazon</b><b class="yahoo">Hello: Yahoo</b>', + @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial_with_object', :collection => [ Customer.new("Amazon"), Customer.new("Yahoo") ]) end - def test_render_partial_with_layout_using_object_and_template_makes_object_available_in_template - assert_equal '<b class="amazon">Hello: Amazon</b>', @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial_with_object', :object => Customer.new("Amazon")) + def test_render_partial_with_layout_using_collection_and_template_makes_current_item_counter_available_in_layout + assert_equal '<b data-counter="0">Hello: Amazon</b><b data-counter="1">Hello: Yahoo</b>', + @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial_with_object_counter', :collection => [ Customer.new("Amazon"), Customer.new("Yahoo") ]) + end + + def test_render_partial_with_layout_using_object_and_template_makes_object_available_in_layout + assert_equal '<b class="amazon">Hello: Amazon</b>', + @view.render(:partial => "test/customer", :layout => 'test/b_layout_for_partial_with_object', :object => Customer.new("Amazon")) end def test_render_partial_with_empty_array_should_return_nil |