Add error messages for missing variables when :strict

This commit is contained in:
Daniel Gaiottino
2014-05-06 16:12:46 +02:00
parent 6a1c3cff1a
commit 2bac6267f9
3 changed files with 25 additions and 0 deletions

View File

@@ -457,4 +457,22 @@ class ContextUnitTest < Test::Unit::TestCase
assert_kind_of CategoryDrop, @context['category']
assert_equal @context, @context['category'].context
end
def test_strict_variables_not_found
with_error_mode(:strict) do
@context['does_not_exist']
assert(@context.errors.length == 1)
assert_equal(@context.errors[0], 'Variable {{does_not_exist}} not found')
end
end
def test_strict_nested_variables_not_found
with_error_mode(:strict) do
@context['hash'] = {'this' => 'exists'}
@context['hash.does_not_exist']
assert(@context.errors.length == 1)
assert_equal(@context.errors[0], 'Variable {{hash.does_not_exist}} not found')
end
end
end # ContextTest