[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
Luke Kanies
luke at madstop.com
Fri Jan 23 14:21:06 UTC 2009
The following commit has been merged in the master branch:
commit 2afc4f5f159870ae2b8af3fb30037716a659dcf4
Author: Luke Kanies <luke at madstop.com>
Date: Tue Sep 30 18:08:55 2008 -0500
Adding tests for the user retrieve method
Signed-off-by: Luke Kanies <luke at madstop.com>
diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index 571781d..bb0a86f 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -272,7 +272,7 @@ module Puppet
current_value = :absent
if absent
- prophash[property] = :absent
+ prophash[property] = :absent
else
current_value = property.retrieve
prophash[property] = current_value
@@ -280,7 +280,6 @@ module Puppet
if property.name == :ensure and current_value == :absent
absent = true
-# next
end
prophash
}
diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb
index 8fe1690..51c6dd8 100755
--- a/spec/unit/type/user.rb
+++ b/spec/unit/type/user.rb
@@ -48,6 +48,30 @@ describe user do
end
end
+ describe "when retrieving all current values" do
+ before do
+ @user = user.create(:name => "foo", :uid => 10, :gid => 10)
+ @properties = {}
+ end
+
+ it "should return a hash containing values for all set properties" do
+ values = @user.retrieve
+ [@user.property(:uid), @user.property(:gid)].each { |property| values.should be_include(property) }
+ end
+
+ it "should set all values to :absent if the user is absent" do
+ @user.property(:ensure).expects(:retrieve).returns :absent
+ @user.property(:uid).expects(:retrieve).never
+ @user.retrieve[@user.property(:uid)].should == :absent
+ end
+
+ it "should include the result of retrieving each property's current value if the user is present" do
+ @user.property(:ensure).expects(:retrieve).returns :present
+ @user.property(:uid).expects(:retrieve).returns 15
+ @user.retrieve[@user.property(:uid)].should == 15
+ end
+ end
+
describe "when managing the ensure property" do
before do
@ensure = user.attrclass(:ensure).new(:resource => @resource)
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list