mirror of
https://github.com/Shopify/liquid.git
synced 2026-10-03 00:55:11 -07: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
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
self.class.name
|
||||||
|
end
|
||||||
|
|
||||||
alias :[] :invoke_drop
|
alias :[] :invoke_drop
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -237,4 +237,9 @@ class DropsTest < Test::Unit::TestCase
|
|||||||
def test_nil_value_access
|
def test_nil_value_access
|
||||||
assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => nil)
|
assert_equal '', Liquid::Template.parse('{{ product[value] }}').render('product' => ProductDrop.new, 'value' => nil)
|
||||||
end
|
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
|
end # DropsTest
|
||||||
|
|||||||
Reference in New Issue
Block a user