From 0150067c40d86e126a2a898501797477c9c6ad9f Mon Sep 17 00:00:00 2001 From: James MacAulay Date: Wed, 19 Aug 2009 19:24:33 -0400 Subject: [PATCH] Revert "Raise FilterNotFound on use of non-existent filter" This reverts commit 01c25a11a3923d9f3a8a00b821c0aba2b586da23. Conflicts: test/context_test.rb --- lib/liquid/context.rb | 2 +- test/context_test.rb | 4 +--- test/security_test.rb | 8 ++++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/liquid/context.rb b/lib/liquid/context.rb index 8b5cfd41..d8a17ec9 100644 --- a/lib/liquid/context.rb +++ b/lib/liquid/context.rb @@ -57,7 +57,7 @@ module Liquid if strainer.respond_to?(method) strainer.__send__(method, *args) else - raise FilterNotFound, "Filter '#{method}' not found" + args.first end end diff --git a/test/context_test.rb b/test/context_test.rb index 87b88406..8137ceb8 100644 --- a/test/context_test.rb +++ b/test/context_test.rb @@ -155,9 +155,7 @@ class ContextTest < Test::Unit::TestCase assert_equal 'hi? hi!', context.invoke(:hi, 'hi?') context = Context.new - assert_raises(FilterNotFound) { - context.invoke(:hi, 'hi?') - } + assert_equal 'hi?', context.invoke(:hi, 'hi?') context.add_filters(filter) assert_equal 'hi? hi!', context.invoke(:hi, 'hi?') diff --git a/test/security_test.rb b/test/security_test.rb index 7bd600bb..1ab0d6fa 100644 --- a/test/security_test.rb +++ b/test/security_test.rb @@ -11,14 +11,14 @@ class SecurityTest < Test::Unit::TestCase def test_no_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) end def test_no_existing_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) 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 = %! 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) 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 = %! 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) end