diff options
| author | Markus Roberts <Markus@reality.com> | 2010-06-28 12:00:55 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-06-28 12:18:25 -0700 |
| commit | 9afc67a465f030a2a1cad0e7ec58e30862f28b4d (patch) | |
| tree | ec1b5ad5558a3ed2264eb44ee7cfae7232e4426f /spec | |
| parent | d62a391695bd68464ba7345616cc1e7686f8f735 (diff) | |
Fix for pre 1.8.7 compatibility in namvar patch
There was a subtle 1.8.7 dependence in the composite key / namevar patch;
Nick discovered that our assumtion that hashes could be used as hash keys
does not hold in earlier bersions of ruby. This patch replaces the hash
valued uniqueness_key with an array of the values of the (ordered) key
attributes.
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/resource_spec.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 4bcfbd3bf..712bc2c8a 100755 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -298,7 +298,7 @@ describe Puppet::Resource do describe "when referring to a resource with name canonicalization" do it "should canonicalize its own name" do res = Puppet::Resource.new("file", "/path/") - res.uniqueness_key.should == {:path => "/path"} + res.uniqueness_key.should == ["/path"] res.ref.should == "File[/path/]" end end @@ -793,16 +793,13 @@ describe Puppet::Resource do end describe "when generating the uniqueness key" do - it "should include all of the key_attributes" do + it "should include all of the key_attributes in alphabetical order by attribute name" do Puppet::Type.type(:file).stubs(:key_attributes).returns [:myvar, :owner, :path] Puppet::Type.type(:file).stubs(:title_patterns).returns( [ [ /(.*)/, [ [:path, lambda{|x| x} ] ] ] ] ) - Puppet::Resource.new("file", "/my/file", :parameters => {:owner => 'root', :content => 'hello'}).uniqueness_key.should == { - :myvar => nil, - :owner => 'root', - :path => '/my/file', - } + res = Puppet::Resource.new("file", "/my/file", :parameters => {:owner => 'root', :content => 'hello'}) + res.uniqueness_key.should == [ nil, 'root', '/my/file'] end end end |
