[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:34:30 UTC 2010


The following commit has been merged in the upstream branch:
commit 8128311690a25d864087a7aee31b233a459345fd
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Wed Jun 9 17:47:39 2010 -0700

    fix tests to reflect methods moved from type/file/owner to provider/file/posix

diff --git a/spec/unit/type/file/owner.rb b/spec/unit/type/file/owner.rb
index 6891ba2..a077cce 100755
--- a/spec/unit/type/file/owner.rb
+++ b/spec/unit/type/file/owner.rb
@@ -6,24 +6,31 @@ property = Puppet::Type.type(:file).attrclass(:owner)
 
 describe property do
     before do
+        # FIXME: many of these tests exercise the provider rather than `owner`
+        # and should be moved into provider tests. ~JW 
+        @provider = Puppet::Type.type(:file).provider(:posix).new
+        @provider.stubs(:uid).with("one").returns(1)
+
         @resource = stub 'resource', :line => "foo", :file => "bar"
         @resource.stubs(:[]).returns "foo"
         @resource.stubs(:[]).with(:path).returns "/my/file"
+        @resource.stubs(:provider).returns @provider
+
         @owner = property.new :resource => @resource
     end
 
     it "should have a method for testing whether an owner is valid" do
-        @owner.must respond_to(:validuser?)
+        @provider.must respond_to(:validuser?)
     end
 
     it "should return the found uid if an owner is valid" do
-        @owner.expects(:uid).with("foo").returns 500
-        @owner.validuser?("foo").should == 500
+        @provider.expects(:uid).with("foo").returns 500
+        @provider.validuser?("foo").should == 500
     end
 
     it "should return false if an owner is not valid" do
-        @owner.expects(:uid).with("foo").returns nil
-        @owner.validuser?("foo").should be_false
+        @provider.expects(:uid).with("foo").returns nil
+        @provider.validuser?("foo").should be_false
     end
 
     describe "when retrieving the current value" do
@@ -48,7 +55,7 @@ describe property do
             @resource.expects(:stat).returns stat
             stat.expects(:uid).returns 1000
 
-            @owner.expects(:warning)
+            @provider.expects(:warning)
             @owner.retrieve.should == :silly
         end
     end
@@ -58,7 +65,7 @@ describe property do
             it "should warn once and return true" do
                 Puppet.features.expects(:root?).returns false
 
-                @owner.expects(:warnonce)
+                @provider.expects(:warnonce)
 
                 @owner.should = [10]
                 @owner.must be_insync(20)
@@ -84,19 +91,19 @@ describe property do
         end
 
         it "should convert the owner name to an integer if the desired owner is a string" do
-            @owner.expects(:uid).with("foo").returns 10
+            @provider.expects(:uid).with("foo").returns 10
             @owner.should = %w{foo}
 
             @owner.must be_insync(10)
         end
         
         it "should not validate that users exist when a user is specified as an integer" do
-            @owner.expects(:uid).never
-            @owner.validuser?(10)
+            @provider.expects(:uid).never
+            @provider.validuser?(10)
         end
 
         it "should fail if it cannot convert an owner name to an integer" do
-            @owner.expects(:uid).with("foo").returns nil
+            @provider.expects(:uid).with("foo").returns nil
             @owner.should = %w{foo}
 
             lambda { @owner.insync?(10) }.should raise_error(Puppet::Error)
@@ -131,9 +138,9 @@ describe property do
 
         it "should use the first valid owner in its 'should' list" do
             @owner.should = %w{one two three}
-            @owner.expects(:validuser?).with("one").returns nil
-            @owner.expects(:validuser?).with("two").returns 500
-            @owner.expects(:validuser?).with("three").never
+            @provider.expects(:validuser?).with("one").returns nil
+            @provider.expects(:validuser?).with("two").returns 500
+            @provider.expects(:validuser?).with("three").never
 
             File.expects(:chown).with(500, nil, "/my/file")
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list