aboutsummaryrefslogtreecommitdiff
path: root/ruby/test/test_errors.rb
blob: c196f043115fa48f84a3407bf5ea4ddab1033c57 (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
29
30
31
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