summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser/ast.rb
blob: 5139437251646c5290aafea42bf005f32a4ed28f (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
33
34
35
36
37
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'

require 'puppet/parser/ast'

describe Puppet::Parser::AST do

    it "should have a doc accessor" do
        ast = Puppet::Parser::AST.new({})
        ast.should respond_to(:doc)
    end

    it "should have a use_docs accessor to indicate it wants documentation" do
        ast = Puppet::Parser::AST.new({})
        ast.should respond_to(:use_docs)
    end

    [ Puppet::Parser::AST::Collection, Puppet::Parser::AST::Definition, Puppet::Parser::AST::Else,
      Puppet::Parser::AST::Function, Puppet::Parser::AST::HostClass, Puppet::Parser::AST::IfStatement,
      Puppet::Parser::AST::Node, Puppet::Parser::AST::Resource, Puppet::Parser::AST::ResourceDefaults,
      Puppet::Parser::AST::ResourceOverride, Puppet::Parser::AST::VarDef
    ].each do |k|
        it "#{k}.use_docs should return true" do
            ast = k.new({})
            ast.use_docs.should be_true
        end
    end

    describe "when initializing" do
        it "should store the doc argument if passed" do
            ast = Puppet::Parser::AST.new(:doc => "documentation")
            ast.doc.should == "documentation"
        end
    end

end