diff options
| author | Luke Kanies <luke@madstop.com> | 2007-11-08 11:28:34 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-11-08 11:28:34 -0600 |
| commit | f465e7e96d62f9b18bdebd51319582d5b2ffa332 (patch) | |
| tree | c33a94d5430d42a702735554c2110c149eae349d /spec/unit/node | |
| parent | 65858356cb3170e04200a6d8204f0978223e2c61 (diff) | |
| parent | 1ffcce079fd7a677ebdc22453a9d10675fb4ed4d (diff) | |
| download | puppet-f465e7e96d62f9b18bdebd51319582d5b2ffa332.tar.gz puppet-f465e7e96d62f9b18bdebd51319582d5b2ffa332.tar.xz puppet-f465e7e96d62f9b18bdebd51319582d5b2ffa332.zip | |
Merge branch 'rest'
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/configuration.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/node/configuration.rb b/spec/unit/node/configuration.rb index 5f807b9b6..e9dc6b85d 100755 --- a/spec/unit/node/configuration.rb +++ b/spec/unit/node/configuration.rb @@ -312,6 +312,17 @@ describe Puppet::Node::Configuration, " when functioning as a resource container @config.resource(@two.ref).should equal(@two) end + it "should set itself as the resource's configuration if it is not a relationship graph" do + @one.expects(:configuration=).with(@config) + @config.add_resource @one + end + + it "should not set itself as the resource's configuration if it is a relationship graph" do + @one.expects(:configuration=).never + @config.is_relationship_graph = true + @config.add_resource @one + end + it "should make all vertices available by resource reference" do @config.add_resource(@one) @config.resource(@one.ref).should equal(@one) @@ -516,6 +527,10 @@ describe Puppet::Node::Configuration, " when creating a relationship graph" do @relationships = @config.relationship_graph end + it "should fail when trying to create a relationship graph for a relationship graph" do + proc { @relationships.relationship_graph }.should raise_error(Puppet::DevError) + end + it "should be able to create a relationship graph" do @relationships.should be_instance_of(Puppet::Node::Configuration) end @@ -578,6 +593,18 @@ describe Puppet::Node::Configuration, " when creating a relationship graph" do @config.resource("File[/yay]").should equal(resource) end + it "should add implicit resources to the relationship graph if there is one" do + args = {:name => "/yay", :ensure => :file} + resource = stub 'file', :ref => "File[/yay]", :configuration= => @config + resource.expects(:implicit=).with(true) + Puppet::Type.type(:file).expects(:create).with(args).returns(resource) + # build the graph + relgraph = @config.relationship_graph + + @config.create_implicit_resource :file, args + relgraph.resource("File[/yay]").should equal(resource) + end + it "should remove resources created mid-transaction" do args = {:name => "/yay", :ensure => :file} resource = stub 'file', :ref => "File[/yay]", :configuration= => @config |
