summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/compiler.rb4
-rwxr-xr-xspec/unit/parser/parser.rb15
2 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/parser/compiler.rb b/spec/unit/parser/compiler.rb
index 9b9428296..0cc6e8a17 100755
--- a/spec/unit/parser/compiler.rb
+++ b/spec/unit/parser/compiler.rb
@@ -82,6 +82,10 @@ describe Puppet::Parser::Compiler do
@parser.expects(:nodes?).returns true
@compiler.ast_nodes?.should be_true
end
+
+ it "should copy the parser version to the catalog" do
+ @compiler.catalog.version.should == @parser.version
+ end
end
describe "when managing scopes" do
diff --git a/spec/unit/parser/parser.rb b/spec/unit/parser/parser.rb
index 3fd1b2d57..bd12f7155 100755
--- a/spec/unit/parser/parser.rb
+++ b/spec/unit/parser/parser.rb
@@ -313,4 +313,19 @@ describe Puppet::Parser do
end
end
+ describe "when determining the configuration version" do
+ it "should default to the current time" do
+ time = Time.now
+
+ Time.stubs(:now).returns time
+ @parser.version.should == time.to_i
+ end
+
+ it "should use the output of the config_version setting if one is provided" do
+ Puppet.settings.stubs(:[]).with(:config_version).returns("/my/foo")
+
+ @parser.expects(:`).with("/my/foo").returns "output\n"
+ @parser.version.should == "output"
+ end
+ end
end