summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-01-20 22:14:10 -0800
committerLuke Kanies <luke@madstop.com>2008-01-20 22:14:10 -0800
commitbee9aba2da453151a80c6e1f25f16bec3bfde8d2 (patch)
treeacf82ee624b2ac7552291d9334cb4a540b68d686 /spec
parentb225e86b120091b213d32e657180ecc446057c0a (diff)
downloadpuppet-bee9aba2da453151a80c6e1f25f16bec3bfde8d2.tar.gz
puppet-bee9aba2da453151a80c6e1f25f16bec3bfde8d2.tar.xz
puppet-bee9aba2da453151a80c6e1f25f16bec3bfde8d2.zip
Environments are now available as variables in manifests,
and specs can be directly executed again.
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb7
-rwxr-xr-xspec/unit/node.rb16
2 files changed, 22 insertions, 1 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index c98709597..3aa3b0202 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -6,7 +6,12 @@ $LOAD_PATH.unshift("#{dir}/../test/lib") # Add the old test dir, so that we can
# include any gems in vendor/gems
Dir["#{dir}/../vendor/gems/**"].map do |path|
- $LOAD_PATH.unshift(File.directory?(lib = "#{dir}/lib") ? lib : path)
+ libpath = File.join(path, "lib")
+ if File.directory?(libpath)
+ $LOAD_PATH.unshift(libpath)
+ else
+ $LOAD_PATH.unshift(path)
+ end
end
require 'puppettest'
diff --git a/spec/unit/node.rb b/spec/unit/node.rb
index 0ce702936..96e1d5617 100755
--- a/spec/unit/node.rb
+++ b/spec/unit/node.rb
@@ -113,6 +113,22 @@ describe Puppet::Node, " when merging facts" do
@node.merge "two" => "three"
@node.parameters["two"].should == "three"
end
+
+ it "should add the environment to the list of parameters" do
+ Puppet.settings.stubs(:value).with(:environments).returns("one,two")
+ Puppet.settings.stubs(:value).with(:environment).returns("one")
+ @node = Puppet::Node.new("testnode", :environment => "one")
+ @node.merge "two" => "three"
+ @node.parameters["environment"].should == "one"
+ end
+
+ it "should not set the environment if it is already set in the parameters" do
+ Puppet.settings.stubs(:value).with(:environments).returns("one,two")
+ Puppet.settings.stubs(:value).with(:environment).returns("one")
+ @node = Puppet::Node.new("testnode", :environment => "one")
+ @node.merge "environment" => "two"
+ @node.parameters["environment"].should == "two"
+ end
end
describe Puppet::Node, " when indirecting" do