Merged pull request #54 from mhw/fix-drop-numeric-parameter.

Fix passing numeric parameter to drops
This commit is contained in:
Tobias Lütke
2011-04-25 08:59:10 -07:00
2 changed files with 11 additions and 6 deletions
+7 -2
View File
@@ -36,7 +36,7 @@ class ProductDrop < Liquid::Drop
class CatchallDrop < Liquid::Drop
def before_method(method)
return 'method: ' << method
return 'method: ' << method.to_s
end
end
@@ -88,12 +88,17 @@ class DropsTest < Test::Unit::TestCase
end
def test_text_drop
def test_unknown_method
output = Liquid::Template.parse( ' {{ product.catchall.unknown }} ' ).render('product' => ProductDrop.new)
assert_equal ' method: unknown ', output
end
def test_integer_argument_drop
output = Liquid::Template.parse( ' {{ product.catchall[8] }} ' ).render('product' => ProductDrop.new)
assert_equal ' method: 8 ', output
end
def test_text_array_drop
output = Liquid::Template.parse( '{% for text in product.texts.array %} {{text}} {% endfor %}' ).render('product' => ProductDrop.new)
assert_equal ' text1 text2 ', output