From bee9aba2da453151a80c6e1f25f16bec3bfde8d2 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sun, 20 Jan 2008 22:14:10 -0800 Subject: Environments are now available as variables in manifests, and specs can be directly executed again. --- spec/unit/node.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec/unit/node.rb') 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 -- cgit