diff options
| author | Luke Kanies <luke@madstop.com> | 2007-09-12 18:40:54 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-09-12 18:40:54 -0500 |
| commit | 3632926089cb27b93ff075c05ba21e2340a562ac (patch) | |
| tree | 358905669eec4eef70e1f7997c35f3ecec82c1f5 /spec/unit/node | |
| parent | 43f22a2414048b180d2c0e2a421fa8d905c4d8eb (diff) | |
| download | puppet-3632926089cb27b93ff075c05ba21e2340a562ac.tar.gz puppet-3632926089cb27b93ff075c05ba21e2340a562ac.tar.xz puppet-3632926089cb27b93ff075c05ba21e2340a562ac.zip | |
Moving the resource container behaviour to the Configuration object, rather than the base PGraph class. I expect I will just do away with PGraph, but for now, I am at least going to keep configuration-related code in that class.
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/configuration.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/node/configuration.rb b/spec/unit/node/configuration.rb index 4429fe3a3..774a1550f 100755 --- a/spec/unit/node/configuration.rb +++ b/spec/unit/node/configuration.rb @@ -133,3 +133,26 @@ describe Puppet::Node::Configuration, " when extracting transobjects" do botarray.include?(:botres).should be_true end end + +describe Puppet::Node::Configuration, " functioning as a resource container" do + before do + @graph = Puppet::Node::Configuration.new("host") + @one = stub 'resource1', :ref => "Me[you]" + @two = stub 'resource2', :ref => "Me[him]" + @dupe = stub 'resource3', :ref => "Me[you]" + end + + it "should make all vertices available by resource reference" do + @graph.add_resource(@one) + @graph.resource(@one.ref).should equal(@one) + end + + it "should not allow two resources with the same resource reference" do + @graph.add_resource(@one) + proc { @graph.add_resource(@dupe) }.should raise_error(ArgumentError) + end + + it "should not store objects that do not respond to :ref" do + proc { @graph.add_resource("thing") }.should raise_error(ArgumentError) + end +end |
