Raise FilterNotFound on use of non-existent filter

This commit is contained in:
Brian Candler
2009-06-06 16:32:20 +01:00
parent f29b9335c5
commit 01c25a11a3
3 changed files with 8 additions and 6 deletions
+3 -1
View File
@@ -156,7 +156,9 @@ class ContextTest < Test::Unit::TestCase
assert_equal 'hi? hi!', context.invoke(:hi, 'hi?')
context = Context.new(@template)
assert_equal 'hi?', context.invoke(:hi, 'hi?')
assert_raises(FilterNotFound) {
context.invoke(:hi, 'hi?')
}
context.add_filters(filter)
assert_equal 'hi? hi!', context.invoke(:hi, 'hi?')
+4 -4
View File
@@ -11,14 +11,14 @@ class SecurityTest < Test::Unit::TestCase
def test_no_instance_eval
text = %( {{ '1+1' | instance_eval }} )
expected = %| 1+1 |
expected = %! Liquid error: Error - filter 'instance_eval' in ''1+1' | instance_eval' could not be found. !
assert_equal expected, Template.parse(text).render(@assigns)
end
def test_no_existing_instance_eval
text = %( {{ '1+1' | __instance_eval__ }} )
expected = %| 1+1 |
expected = %! Liquid error: Error - filter '__instance_eval__' in ''1+1' | __instance_eval__' could not be found. !
assert_equal expected, Template.parse(text).render(@assigns)
end
@@ -26,7 +26,7 @@ class SecurityTest < Test::Unit::TestCase
def test_no_instance_eval_after_mixing_in_new_filter
text = %( {{ '1+1' | instance_eval }} )
expected = %| 1+1 |
expected = %! Liquid error: Error - filter 'instance_eval' in ''1+1' | instance_eval' could not be found. !
assert_equal expected, Template.parse(text).render(@assigns)
end
@@ -34,7 +34,7 @@ class SecurityTest < Test::Unit::TestCase
def test_no_instance_eval_later_in_chain
text = %( {{ '1+1' | add_one | instance_eval }} )
expected = %| 1+1 + 1 |
expected = %! Liquid error: Error - filter 'instance_eval' in ''1+1' | add_one | instance_eval' could not be found. !
assert_equal expected, Template.parse(text).render(@assigns, :filters => SecurityFilter)
end