From bc7f1caa35368f9628b1f1f3d173262e8b50b526 Mon Sep 17 00:00:00 2001 From: Guilherme Carreiro Date: Fri, 8 May 2026 09:51:31 +0200 Subject: [PATCH] Remove support for contextualization --- lib/liquid/self_drop.rb | 2 ++ test/integration/self_drop_context_test.rb | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/liquid/self_drop.rb b/lib/liquid/self_drop.rb index fa3fa27a..2f54fd38 100644 --- a/lib/liquid/self_drop.rb +++ b/lib/liquid/self_drop.rb @@ -31,6 +31,8 @@ module Liquid @self_context.variable_defined?(key) end + def context=(_); end + def to_liquid self end diff --git a/test/integration/self_drop_context_test.rb b/test/integration/self_drop_context_test.rb index 86c21c0a..9a1c86cf 100644 --- a/test/integration/self_drop_context_test.rb +++ b/test/integration/self_drop_context_test.rb @@ -68,4 +68,24 @@ class SelfDropContextTest < Minitest::Test assert_template_result('42', source) 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