diff --git a/test/integration/context_test.rb b/test/integration/context_test.rb index a6ef3e58..874cc8bd 100644 --- a/test/integration/context_test.rb +++ b/test/integration/context_test.rb @@ -405,45 +405,42 @@ class ContextTest < Minitest::Test end def test_lambda_is_called_once + @global = 0 + @context['callcount'] = proc { - @global ||= 0 - @global += 1 + @global += 1 @global.to_s } assert_equal('1', @context['callcount']) assert_equal('1', @context['callcount']) assert_equal('1', @context['callcount']) - - @global = nil end def test_nested_lambda_is_called_once + @global = 0 + @context['callcount'] = { "lambda" => proc { - @global ||= 0 - @global += 1 + @global += 1 @global.to_s } } assert_equal('1', @context['callcount.lambda']) assert_equal('1', @context['callcount.lambda']) assert_equal('1', @context['callcount.lambda']) - - @global = nil end def test_lambda_in_array_is_called_once + @global = 0 + @context['callcount'] = [1, 2, proc { - @global ||= 0 - @global += 1 + @global += 1 @global.to_s }, 4, 5] assert_equal('1', @context['callcount[2]']) assert_equal('1', @context['callcount[2]']) assert_equal('1', @context['callcount[2]']) - - @global = nil end def test_access_to_context_from_proc