diff options
author | Michael V. O'Brien <michael@reductivelabs.com> | 2007-09-25 12:00:07 -0500 |
---|---|---|
committer | Michael V. O'Brien <michael@reductivelabs.com> | 2007-09-25 12:00:07 -0500 |
commit | ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3 (patch) | |
tree | 8c8960cac1d7b3e8b48e44163062be3b3f4c201f /spec/integration/node.rb | |
parent | f8ab62b212788a4591276c95b5f67217f7517e4e (diff) | |
parent | ffaa8ce07979f4db860950fa9be08ca37964206f (diff) | |
download | puppet-ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3.tar.gz puppet-ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3.tar.xz puppet-ff2828f5dbe68ff1cb06a3503590a3e4bd1b59e3.zip |
Merge branch 'master' of git://reductivelabs.com/puppet
Diffstat (limited to 'spec/integration/node.rb')
-rwxr-xr-x | spec/integration/node.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/integration/node.rb b/spec/integration/node.rb new file mode 100755 index 000000000..8bc641bae --- /dev/null +++ b/spec/integration/node.rb @@ -0,0 +1,46 @@ +#!/usr/bin/env ruby +# +# Created by Luke Kanies on 2007-9-23. +# Copyright (c) 2007. All rights reserved. + +require File.dirname(__FILE__) + '/../spec_helper' + +require 'puppet/node' + +describe Puppet::Node, " when using the memory terminus" do + before do + @name = "me" + @node = Puppet::Node.new(@name) + Puppet[:node_terminus] = "memory" + end + + it "should find no nodes by default" do + Puppet::Node.find(@name).should be_nil + end + + it "should be able to find nodes that were previously saved" do + @node.save + Puppet::Node.find(@name).should equal(@node) + end + + it "should replace existing saved nodes when a new node with the same name is saved" do + @node.save + two = Puppet::Node.new(@name) + two.save + Puppet::Node.find(@name).should equal(two) + end + + it "should be able to remove previously saved nodes" do + @node.save + Puppet::Node.destroy(@node) + Puppet::Node.find(@name).should be_nil + end + + it "should fail when asked to destroy a node that does not exist" do + proc { Puppet::Node.destroy(@node) }.should raise_error(ArgumentError) + end + + after do + Puppet.settings.clear + end +end |