From abe810de48da22fbc8e28369f50e2863291fe505 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Wed, 5 Sep 2018 22:24:05 -0400 Subject: php: fix doc typo, ruby: add tests --- ruby/test/test_cache.rb | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ruby/test/test_cache.rb (limited to 'ruby/test/test_cache.rb') 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 -- cgit v1.2.3