Fix a regression in tablerow limit parameter.

I had accidentally read slice_collection_using_each as using to as an
inclusive limit rather than exclusive, and no tests covered the offset or
limit parameters.
This commit is contained in:
Dylan Smith
2012-06-21 14:56:05 -04:00
parent d0184555d9
commit f5a20ff8e8
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -54,4 +54,10 @@ class HtmlTagTest < Test::Unit::TestCase
'{% tablerow n in numbers cols:3%} {{n}} {% endtablerow %}',
'numbers' => ArrayDrop.new([1,2,3,4,5,6]))
end
def test_offset_and_limit
assert_template_result("<tr class=\"row1\">\n<td class=\"col1\"> 1 </td><td class=\"col2\"> 2 </td><td class=\"col3\"> 3 </td></tr>\n<tr class=\"row2\"><td class=\"col1\"> 4 </td><td class=\"col2\"> 5 </td><td class=\"col3\"> 6 </td></tr>\n",
'{% tablerow n in numbers cols:3 offset:1 limit:6%} {{n}} {% endtablerow %}',
'numbers' => [0,1,2,3,4,5,6,7])
end
end # HtmlTagTest