Merge pull request #232 from Shopify/to_liquid_stuff

Always call 'to_liquid' on stuff in map filter and allow to_liquid to be...
This commit is contained in:
Florian Weingarten
2013-10-09 15:24:20 -04:00
committed by Arthur Neves
parent 2e71ce1efe
commit 6eb1f174de
3 changed files with 13 additions and 2 deletions
+5
View File
@@ -86,6 +86,11 @@ class DropsTest < Test::Unit::TestCase
assert_equal "", Liquid::Template.parse('{{ product | map: "whatever" }}').render('product' => ProductDrop.new)
end
def test_drops_respond_to_to_liquid
assert_equal "text1", Liquid::Template.parse("{{ product.to_liquid.texts.text }}").render('product' => ProductDrop.new)
assert_equal "text1", Liquid::Template.parse('{{ product | map: "to_liquid" | map: "texts" | map: "text" }}').render('product' => ProductDrop.new)
end
def test_text_drop
output = Liquid::Template.parse( ' {{ product.texts.text }} ' ).render('product' => ProductDrop.new)
assert_equal ' text1 ', output