Make sure the context gets set

This commit is contained in:
Daniel Huckstep
2013-06-06 10:19:20 -06:00
parent ba5e65f685
commit 076ae903c0
2 changed files with 11 additions and 2 deletions
+6
View File
@@ -8,6 +8,10 @@ class TemplateContextDrop < Liquid::Drop
def foo
'fizzbuzz'
end
def baz
@context.registers['lulz']
end
end
class TemplateTest < Test::Unit::TestCase
@@ -133,8 +137,10 @@ class TemplateTest < Test::Unit::TestCase
def test_can_use_drop_as_context
t = Template.new
t.registers['lulz'] = 'haha'
drop = TemplateContextDrop.new
assert_equal 'fizzbuzz', t.parse('{{foo}}').render(drop)
assert_equal 'bar', t.parse('{{bar}}').render(drop)
assert_equal 'haha', t.parse("{{baz}}").render(drop)
end
end # TemplateTest