summaryrefslogtreecommitdiff
path: root/ruby/test/test_errors.rb
diff options
context:
space:
mode:
authorPaul Duncan <pabs@pablotron.org>2018-09-05 22:24:05 -0400
committerPaul Duncan <pabs@pablotron.org>2018-09-05 22:24:18 -0400
commitabe810de48da22fbc8e28369f50e2863291fe505 (patch)
tree3b15905a8ab7f8254d7251bed7c3e84084cdb14b /ruby/test/test_errors.rb
parentff3344c570a8200c2a5933ae6790e24611008bbf (diff)
downloadluigi-template-abe810de48da22fbc8e28369f50e2863291fe505.tar.bz2
luigi-template-abe810de48da22fbc8e28369f50e2863291fe505.zip
php: fix doc typo, ruby: add tests
Diffstat (limited to 'ruby/test/test_errors.rb')
-rw-r--r--ruby/test/test_errors.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/ruby/test/test_errors.rb b/ruby/test/test_errors.rb
new file mode 100644
index 0000000..c196f04
--- /dev/null
+++ b/ruby/test/test_errors.rb
@@ -0,0 +1,32 @@
+require 'minitest/autorun'
+require 'luigi-template'
+
+class ErrorsTest < MiniTest::Test
+ def test_unknown_key_error
+ assert_raises(Luigi::UnknownKeyError) do
+ Luigi::Template.run('foo%{unknown-key}', {
+ bar: 'foo',
+ })
+ end
+ end
+
+ def test_unknown_filter_error
+ assert_raises(Luigi::UnknownFilterError) do
+ Luigi::Template.run('foo%{bar | unknown-filter}', {
+ bar: 'foo',
+ })
+ end
+ end
+
+ def test_unknown_template_error
+ assert_raises(Luigi::UnknownTemplateError) do
+ cache = Luigi::Cache.new({
+ foo: 'foo%{bar}',
+ })
+
+ cache.run('unknown-template', {
+ bar: 'foo'
+ })
+ end
+ end
+end