summaryrefslogtreecommitdiff
path: root/ruby/test/test_cache.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/test/test_cache.rb')
-rw-r--r--ruby/test/test_cache.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/ruby/test/test_cache.rb b/ruby/test/test_cache.rb
new file mode 100644
index 0000000..4296410
--- /dev/null
+++ b/ruby/test/test_cache.rb
@@ -0,0 +1,28 @@
+require 'minitest/autorun'
+require 'luigi-template'
+
+class TemplateTest < 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