mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
add global_filter
add a global filter using a proc only add one proc and not an array add tests to make sure the global_filter is applied after native filters
This commit is contained in:
@@ -466,4 +466,18 @@ class ContextUnitTest < Minitest::Test
|
||||
assert contx
|
||||
assert_nil contx['poutine']
|
||||
end
|
||||
|
||||
def test_apply_global_filter
|
||||
global_filter_proc = ->(output) { "#{output} filtered" }
|
||||
|
||||
context = Context.new
|
||||
context.global_filter = global_filter_proc
|
||||
|
||||
assert_equal 'hi filtered', context.apply_global_filter('hi')
|
||||
end
|
||||
|
||||
def test_apply_global_filter_when_no_global_filter_exist
|
||||
context = Context.new
|
||||
assert_equal 'hi', context.apply_global_filter('hi')
|
||||
end
|
||||
end # ContextTest
|
||||
|
||||
Reference in New Issue
Block a user