blob: 66a7e9f207b63020bd92540255b70fb045ff20e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
require 'minitest/autorun'
require 'luigi-template'
class CacheTest < MiniTest::Test
def test_cache
cache = Luigi::Cache.new({
foo: 'foo%{bar}',
})
r = cache.run(:foo, bar: 'foo')
assert_equal 'foofoo', r
end
def test_cache_with_custom_filters
cache = Luigi::Cache.new({
foo: 'foo%{bar | barify}',
}, {
barify: proc { |v|
"bar-#{v}-bar"
},
})
r = cache.run(:foo, bar: 'foo')
assert_equal 'foobar-foo-bar', r
end
end
|