[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:05 UTC 2009


The following commit has been merged in the master branch:
commit b9c75cd14cfae6dca035519f13f7d159f2889d0a
Author: Luke Kanies <luke at madstop.com>
Date:   Tue Sep 30 13:33:10 2008 -0500

    Rewriting the user tests, in preparation for enhancing them
    
    Signed-off-by: Luke Kanies <luke at madstop.com>

diff --git a/spec/unit/type/user.rb b/spec/unit/type/user.rb
index d16d752..4576f56 100755
--- a/spec/unit/type/user.rb
+++ b/spec/unit/type/user.rb
@@ -2,55 +2,23 @@
 
 require File.dirname(__FILE__) + '/../../spec_helper'
 
-module UserTestFunctions
-    def mkuser(name)
-        user = nil;
-        lambda {
-            user = Puppet::Type.type(:user).create(
-                :name => name,
-                :comment => "Puppet Testing User",
-                :gid => Puppet::Util::SUIDManager.gid,
-                :shell => "/bin/sh",
-                :home => "/home/%s" % name
-        ) }.should_not raise_error
-        user.should_not be_nil
-        user
-    end
-
-    def test_provider_class(klass)
-        klass.should_not be_nil
-        klass.should be_an_instance_of(Class)
-        superclasses = []
-        while klass = klass.superclass
-            superclasses << klass
-        end
-        superclasses.should include(Puppet::Provider)
-    end
-end
-
-describe Puppet::Type.type(:user) do
+user = Puppet::Type.type(:user)
 
-    include UserTestFunctions
+describe user do
+    after { user.clear }
 
     it "should have a default provider inheriting from Puppet::Provider" do
-        test_provider_class Puppet::Type.type(:user).defaultprovider
+        user.defaultprovider.ancestors.should be_include(Puppet::Provider)
     end
 
     it "should be able to create a instance" do
-        mkuser "123testuser1"
+        user.create(:name => "foo").should_not be_nil
     end
-end
-
-describe Puppet::Type.type(:user), "instances" do
 
-    include UserTestFunctions
+    describe "instances" do
 
-    it "should have a valid provider" do
-        user = mkuser "123testuser2"
-        user.provider.should_not be_nil
-        test_provider_class user.provider.class
+        it "should have a valid provider" do
+            user.create(:name => "foo").provider.class.ancestors.should be_include(Puppet::Provider)
+        end
     end
-
 end
-
-

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list