diff options
Diffstat (limited to 'spec/unit/node.rb')
-rwxr-xr-x | spec/unit/node.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/unit/node.rb b/spec/unit/node.rb index 6603f6b58..4a41dadf9 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 @@ -132,7 +148,7 @@ describe Puppet::Node, "when indirecting" do end after do - Puppet::Indirector::Indirection.clear_cache + Puppet::Util::Cacher.invalidate end end |