diff options
| author | Luke Kanies <luke@madstop.com> | 2007-11-28 15:20:52 -0600 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-11-28 15:20:52 -0600 |
| commit | 11ae473e3852adcc382a3efea2329586d2e4bcb3 (patch) | |
| tree | 7a7ff70f7d9f7bc9af0635c56690fb9fc810b9f5 /spec/unit/node | |
| parent | 8127397e1efafc13975b79eabf7ce951c1e90114 (diff) | |
| download | puppet-11ae473e3852adcc382a3efea2329586d2e4bcb3.tar.gz puppet-11ae473e3852adcc382a3efea2329586d2e4bcb3.tar.xz puppet-11ae473e3852adcc382a3efea2329586d2e4bcb3.zip | |
Theoretically, this patch is to fix #917 (which it does), but
there were enough problems fixing it that I decided something
more drastic needed to be done.
This uses the new Puppet::ResourceReference class to canonize
what a resource reference looks like and how to retrieve resources
via their references. Specifically, it guarantees that resource types
are always capitalized, even when they include '::' in them.
While many files are modified in this commit, the majority of changes are
quite small, and most of the changes are fixing the tests to use
capitalized types.
As we look at consolidating some of our resource types, we could consolidate
the ResourceReference stuff at the same time, but at least the
Puppet::Parser::ResourceReference class subclasses the main Puppet::ResourceReference
class.
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/configuration.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/node/configuration.rb b/spec/unit/node/configuration.rb index 0a8b47fc5..0023e0f2b 100755 --- a/spec/unit/node/configuration.rb +++ b/spec/unit/node/configuration.rb @@ -351,6 +351,18 @@ describe Puppet::Node::Configuration, " when functioning as a resource container @config.vertices.find { |r| r.ref == @one.ref }.should equal(@one) end + it "should canonize how resources are referred to during retrieval when both type and title are provided" do + @config.add_resource(@one) + + @config.resource("me", "one").should equal(@one) + end + + it "should canonize how resources are referred to during retrieval when just the title is provided" do + @config.add_resource(@one) + + @config.resource("me[one]", nil).should equal(@one) + end + it "should not allow two resources with the same resource reference" do @config.add_resource(@one) proc { @config.add_resource(@dupe) }.should raise_error(ArgumentError) |
