aboutsummaryrefslogtreecommitdiff
path: root/vendor/supply_drop/test/syntax_checker_test.rb
blob: 15f6e73cc8913a9d24fc32155b2ec9bdd2c25d46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'test/unit'
require File.expand_path('../../lib/supply_drop/syntax_checker', __FILE__)

class SyntaxCheckerTest < Test::Unit::TestCase

  def test_syntax_checks_puppet_files
    checker = SupplyDrop::SyntaxChecker.new(File.expand_path('../files', __FILE__))
    errors = checker.validate_puppet_files
    assert_equal 1, errors.count
    file, error = errors.first
    assert_match %r[manifests/invalid.pp$], file
    assert_match %r[expected '\}'], error
  end

  def test_synatx_checks_erb_files
    checker = SupplyDrop::SyntaxChecker.new(File.expand_path('../files', __FILE__))
    errors = checker.validate_templates
    assert_equal 1, errors.count
    file, error = errors.first
    assert_match %r[templates/invalid.erb$], file
    assert_match %r[syntax error], error
  end
end