test/liquid/drop_test.rb in liquid-2.5.0 vs test/liquid/drop_test.rb in liquid-2.5.1

- old
+ new

@@ -69,26 +69,32 @@ class DropsTest < Test::Unit::TestCase include Liquid def test_product_drop - assert_nothing_raised do tpl = Liquid::Template.parse( ' ' ) tpl.render('product' => ProductDrop.new) end end + def test_drop_does_only_respond_to_whitelisted_methods + assert_equal "", Liquid::Template.parse("{{ product.inspect }}").render('product' => ProductDrop.new) + assert_equal "", Liquid::Template.parse("{{ product.pretty_inspect }}").render('product' => ProductDrop.new) + assert_equal "", Liquid::Template.parse("{{ product.whatever }}").render('product' => ProductDrop.new) + assert_equal "", Liquid::Template.parse('{{ product | map: "inspect" }}').render('product' => ProductDrop.new) + assert_equal "", Liquid::Template.parse('{{ product | map: "pretty_inspect" }}').render('product' => ProductDrop.new) + assert_equal "", Liquid::Template.parse('{{ product | map: "whatever" }}').render('product' => ProductDrop.new) + end + def test_text_drop output = Liquid::Template.parse( ' {{ product.texts.text }} ' ).render('product' => ProductDrop.new) assert_equal ' text1 ', output - end 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