[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Dominic Cleal dcleal at redhat.com
Tue May 10 08:05:00 UTC 2011


The following commit has been merged in the experimental branch:
commit f5e21f0796038f8635af0f826eab9d62b494ba49
Author: Dominic Cleal <dcleal at redhat.com>
Date:   Sat Feb 19 18:58:51 2011 +0000

    (#6324) Use real service resource object instead of a stub

diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb
index 4c52ed1..2f7ecc4 100755
--- a/spec/unit/provider/service/smf_spec.rb
+++ b/spec/unit/provider/service/smf_spec.rb
@@ -12,17 +12,10 @@ describe provider_class do
 
   before(:each) do
     # Create a mock resource
-    @resource = stub 'resource'
+    @resource = Puppet::Type.type(:service).new(
+      :name => "/system/myservice", :ensure => :running, :enable => :true)
     @provider = provider_class.new(@resource)
 
-    @resource.stubs(:[]).returns(nil)
-    @resource.stubs(:[]).with(:name).returns "/system/myservice"
-    @resource.stubs(:[]).with(:ensure).returns :enabled
-    @resource.stubs(:[]).with(:enable).returns :true
-    @resource.stubs(:name).returns "/system/myservice"
-    @resource.stubs(:ref).returns "Service[/system/myservice]"
-    @provider.stubs(:resource).returns @resource
-
     FileTest.stubs(:file?).with('/usr/sbin/svcadm').returns true
     FileTest.stubs(:executable?).with('/usr/sbin/svcadm').returns true
     FileTest.stubs(:file?).with('/usr/bin/svcs').returns true
@@ -108,7 +101,7 @@ describe provider_class do
     end
 
     it "should import the manifest if service is not found" do
-      @resource.stubs(:[]).with(:manifest).returns("/tmp/myservice.xml")
+      @resource[:manifest] = "/tmp/myservice.xml"
       $CHILD_STATUS.stubs(:exitstatus).returns(1)
       @provider.expects(:svccfg).with(:import, "/tmp/myservice.xml")
       @provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "/system/myservice"], true)

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list