mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Revert "Raise FilterNotFound on use of non-existent filter"
This reverts commit 01c25a11a3.
Conflicts:
test/context_test.rb
This commit is contained in:
@@ -57,7 +57,7 @@ module Liquid
|
|||||||
if strainer.respond_to?(method)
|
if strainer.respond_to?(method)
|
||||||
strainer.__send__(method, *args)
|
strainer.__send__(method, *args)
|
||||||
else
|
else
|
||||||
raise FilterNotFound, "Filter '#{method}' not found"
|
args.first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -155,9 +155,7 @@ class ContextTest < Test::Unit::TestCase
|
|||||||
assert_equal 'hi? hi!', context.invoke(:hi, 'hi?')
|
assert_equal 'hi? hi!', context.invoke(:hi, 'hi?')
|
||||||
|
|
||||||
context = Context.new
|
context = Context.new
|
||||||
assert_raises(FilterNotFound) {
|
assert_equal 'hi?', context.invoke(:hi, 'hi?')
|
||||||
context.invoke(:hi, 'hi?')
|
|
||||||
}
|
|
||||||
|
|
||||||
context.add_filters(filter)
|
context.add_filters(filter)
|
||||||
assert_equal 'hi? hi!', context.invoke(:hi, 'hi?')
|
assert_equal 'hi? hi!', context.invoke(:hi, 'hi?')
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ class SecurityTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_no_instance_eval
|
def test_no_instance_eval
|
||||||
text = %( {{ '1+1' | instance_eval }} )
|
text = %( {{ '1+1' | instance_eval }} )
|
||||||
expected = %! Liquid error: Error - filter 'instance_eval' in ''1+1' | instance_eval' could not be found. !
|
expected = %| 1+1 |
|
||||||
|
|
||||||
assert_equal expected, Template.parse(text).render(@assigns)
|
assert_equal expected, Template.parse(text).render(@assigns)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_no_existing_instance_eval
|
def test_no_existing_instance_eval
|
||||||
text = %( {{ '1+1' | __instance_eval__ }} )
|
text = %( {{ '1+1' | __instance_eval__ }} )
|
||||||
expected = %! Liquid error: Error - filter '__instance_eval__' in ''1+1' | __instance_eval__' could not be found. !
|
expected = %| 1+1 |
|
||||||
|
|
||||||
assert_equal expected, Template.parse(text).render(@assigns)
|
assert_equal expected, Template.parse(text).render(@assigns)
|
||||||
end
|
end
|
||||||
@@ -26,7 +26,7 @@ class SecurityTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_no_instance_eval_after_mixing_in_new_filter
|
def test_no_instance_eval_after_mixing_in_new_filter
|
||||||
text = %( {{ '1+1' | instance_eval }} )
|
text = %( {{ '1+1' | instance_eval }} )
|
||||||
expected = %! Liquid error: Error - filter 'instance_eval' in ''1+1' | instance_eval' could not be found. !
|
expected = %| 1+1 |
|
||||||
|
|
||||||
assert_equal expected, Template.parse(text).render(@assigns)
|
assert_equal expected, Template.parse(text).render(@assigns)
|
||||||
end
|
end
|
||||||
@@ -34,7 +34,7 @@ class SecurityTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_no_instance_eval_later_in_chain
|
def test_no_instance_eval_later_in_chain
|
||||||
text = %( {{ '1+1' | add_one | instance_eval }} )
|
text = %( {{ '1+1' | add_one | instance_eval }} )
|
||||||
expected = %! Liquid error: Error - filter 'instance_eval' in ''1+1' | add_one | instance_eval' could not be found. !
|
expected = %| 1+1 + 1 |
|
||||||
|
|
||||||
assert_equal expected, Template.parse(text).render(@assigns, :filters => SecurityFilter)
|
assert_equal expected, Template.parse(text).render(@assigns, :filters => SecurityFilter)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user