Liquid::Drop should not return a string representation of standard ruby objects

This commit is contained in:
Adam Doeler
2014-02-07 14:48:02 -05:00
parent 765751b9cb
commit 5f8a028a56
2 changed files with 9 additions and 0 deletions

View File

@@ -52,6 +52,10 @@ module Liquid
self
end
def to_s
self.class.name
end
alias :[] :invoke_drop
private

View File

@@ -237,4 +237,9 @@ class DropsTest < Test::Unit::TestCase
def test_nil_value_access
assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => nil)
end
def test_default_to_s_on_drops
assert_equal 'ProductDrop', Liquid::Template.parse("{{ product }}").render('product' => ProductDrop.new)
assert_equal 'EnumerableDrop', Liquid::Template.parse('{{ collection }}').render('collection' => EnumerableDrop.new)
end
end # DropsTest