diff options
author | Paul Duncan <pabs@pablotron.org> | 2018-09-05 22:24:05 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2018-09-05 22:24:18 -0400 |
commit | abe810de48da22fbc8e28369f50e2863291fe505 (patch) | |
tree | 3b15905a8ab7f8254d7251bed7c3e84084cdb14b /ruby/test/test_cache.rb | |
parent | ff3344c570a8200c2a5933ae6790e24611008bbf (diff) | |
download | luigi-template-abe810de48da22fbc8e28369f50e2863291fe505.tar.bz2 luigi-template-abe810de48da22fbc8e28369f50e2863291fe505.zip |
php: fix doc typo, ruby: add tests
Diffstat (limited to 'ruby/test/test_cache.rb')
-rw-r--r-- | ruby/test/test_cache.rb | 28 |
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 |