Make partial counter start from 0.

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
Frederick Cheung 2008-06-05 20:48:42 +01:00 committed by Pratik Naik
parent df8154c845
commit 2e0765a003
2 changed files with 3 additions and 3 deletions

@ -22,10 +22,10 @@ def render
end
def render_member(object)
@locals[@counter_name] += 1
@locals[:object] = @locals[@variable_name] = object
template = render_template
@locals[@counter_name] += 1
@locals.delete(@variable_name)
@locals.delete(:object)

@ -742,7 +742,7 @@ def test_partial_collection
def test_partial_collection_with_counter
get :partial_collection_with_counter
assert_equal "david1mary2", @response.body
assert_equal "david0mary1", @response.body
end
def test_partial_collection_with_locals
@ -762,7 +762,7 @@ def test_partial_collection_shorthand_with_locals
def test_partial_collection_shorthand_with_different_types_of_records
get :partial_collection_shorthand_with_different_types_of_records
assert_equal "Bonjour bad customer: mark1Bonjour good customer: craig2Bonjour bad customer: john3Bonjour good customer: zach4Bonjour good customer: brandon5Bonjour bad customer: dan6", @response.body
assert_equal "Bonjour bad customer: mark0Bonjour good customer: craig1Bonjour bad customer: john2Bonjour good customer: zach3Bonjour good customer: brandon4Bonjour bad customer: dan5", @response.body
end
def test_empty_partial_collection