summaryrefslogtreecommitdiffstats
path: root/spec/integration/parser/compiler.rb
blob: 27666400bfa05490c741f46b36f3c4cc64082d2c (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
#!/usr/bin/env ruby

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

describe Puppet::Parser::Compiler do
    before :each do
        @node = Puppet::Node.new "testnode"

        @scope_resource = stub 'scope_resource', :builtin? => true, :finish => nil, :ref => 'Class[main]'
        @scope = stub 'scope', :resource => @scope_resource, :source => mock("source")
    end

    after do
        Puppet.settings.clear
    end

    it "should be able to determine the configuration version from a local version control repository" do
        # This should always work, because we should always be
        # in the puppet repo when we run this.
        version = %x{git rev-parse HEAD}.chomp

        Puppet.settings[:config_version] = 'git rev-parse HEAD'

        @parser = Puppet::Parser::Parser.new :environment => "development"
        @compiler = Puppet::Parser::Compiler.new(@node, @parser)

        @compiler.catalog.version.should == version
    end
end