mirror of
https://github.com/kemko/liquid.git
synced 2026-01-06 02:05:41 +03:00
Liquid::Drop should not return a string representation of standard ruby objects
This commit is contained in:
@@ -52,6 +52,10 @@ module Liquid
|
||||
self
|
||||
end
|
||||
|
||||
def to_s
|
||||
self.class.name
|
||||
end
|
||||
|
||||
alias :[] :invoke_drop
|
||||
|
||||
private
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user