mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Remove support for contextualization
This commit is contained in:
@@ -31,6 +31,8 @@ module Liquid
|
|||||||
@self_context.variable_defined?(key)
|
@self_context.variable_defined?(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def context=(_); end
|
||||||
|
|
||||||
def to_liquid
|
def to_liquid
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -68,4 +68,24 @@ class SelfDropContextTest < Minitest::Test
|
|||||||
|
|
||||||
assert_template_result('42', source)
|
assert_template_result('42', source)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_self_drop_context_writer_is_a_noop
|
||||||
|
context = Context.new
|
||||||
|
drop = SelfDrop.new(context)
|
||||||
|
assert(drop.respond_to?(:context=))
|
||||||
|
drop.context = Context.new
|
||||||
|
assert_nil(drop.instance_variable_get(:@context))
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_self_drop_with_strict_variables_does_not_raise_for_defined_var
|
||||||
|
t = Template.parse('{{ self.x }}')
|
||||||
|
result = t.render({ 'x' => 42 }, strict_variables: true)
|
||||||
|
assert_equal('42', result)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_self_drop_with_strict_variables_returns_nil_for_undefined_var
|
||||||
|
t = Template.parse('{{ self.x }}')
|
||||||
|
result = t.render({}, strict_variables: true)
|
||||||
|
assert_equal('', result)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user