summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2011-03-15 15:29:01 -0700
committerJesse Wolfe <jes5199@gmail.com>2011-03-15 17:46:40 -0700
commit4f34dbf206e591614c2fc06ce9bed1628ee85715 (patch)
tree6788c517b32c36f1c5e58d239143bca39f0775cb /spec/unit
parent9781032736a34f577241828bcf812a648b4f42e9 (diff)
Fix #5610: Prevent unnecessary RAL lookups
Reviewed-By: Paul Berry <paul@puppetlabs.com>
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/type_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb
index b7a08977e..6d9d0b234 100755
--- a/spec/unit/type_spec.rb
+++ b/spec/unit/type_spec.rb
@@ -434,7 +434,7 @@ describe Puppet::Type do
patterns.length.should == 1
patterns[0].length.should == 2
end
-
+
it "should have a regexp that captures the entire string" do
patterns = @type_class.title_patterns
string = "abc\n\tdef"
@@ -570,4 +570,15 @@ describe Puppet::Type.metaparamclass(:audit) do
@resource[:audit] = :noop
@resource.parameter(:noop).should be_nil
end
+
+ describe "when generating the uniqueness key" do
+ it "should include all of the key_attributes in alphabetical order by attribute name" do
+ Puppet::Type.type(:file).stubs(:key_attributes).returns [:path, :mode, :owner]
+ Puppet::Type.type(:file).stubs(:title_patterns).returns(
+ [ [ /(.*)/, [ [:path, lambda{|x| x} ] ] ] ]
+ )
+ res = Puppet::Type.type(:file).new( :title => '/my/file', :path => '/my/file', :owner => 'root', :content => 'hello' )
+ res.uniqueness_key.should == [ nil, 'root', '/my/file']
+ end
+ end
end