From: Daniel Pittman <[email protected]>

Setting the age value to -1 will disable the specific aging value; we should
accept that, but continue to reject null or empty values as invalid.

Add tests to verify that this code enforces as expected.
---
 spec/unit/type/user_spec.rb |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/spec/unit/type/user_spec.rb b/spec/unit/type/user_spec.rb
index 0c3e2ab..2971344 100755
--- a/spec/unit/type/user_spec.rb
+++ b/spec/unit/type/user_spec.rb
@@ -245,6 +245,34 @@ describe user do
     end
   end
 
+  describe "when managing minimum password age" do
+    before do
+      @age = user.attrclass(:password_min_age).new(:resource => @resource)
+    end
+
+    it "should accept a negative minimum age" do
+      expect { @age.should = -1 }.should_not raise_error
+    end
+
+    it "should fail with an empty minimum age" do
+      expect { @age.should = '' }.should raise_error(Puppet::Error)
+    end
+  end
+
+  describe "when managing maximum password age" do
+    before do
+      @age = user.attrclass(:password_max_age).new(:resource => @resource)
+    end
+
+    it "should accept a negative maximum age" do
+      expect { @age.should = -1 }.should_not raise_error
+    end
+
+    it "should fail with an empty maximum age" do
+      expect { @age.should = '' }.should raise_error(Puppet::Error)
+    end
+  end
+
   describe "when managing passwords" do
     before do
       @password = user.attrclass(:password).new(:resource => @resource, 
:should => "mypass")
-- 
1.7.3.5

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to