[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5rc1-120-g2247c80
Paul Berry
paul at puppetlabs.com
Mon Feb 7 06:39:58 UTC 2011
The following commit has been merged in the upstream branch:
commit e2700869a98ed769cea3d880a23e2f80330ea0fc
Author: Paul Berry <paul at puppetlabs.com>
Date: Fri Jan 7 15:21:20 2011 -0800
Prep for fixing #5710: Refactor stub provider in resource harness spec
Moved the stub provider to its own method so that it can be re-used in
additional spec tests.
Paired-with: Jesse Wolfe <jesse at puppetlabs.com>
diff --git a/spec/unit/transaction/resource_harness_spec.rb b/spec/unit/transaction/resource_harness_spec.rb
index ca35740..f0c360e 100755
--- a/spec/unit/transaction/resource_harness_spec.rb
+++ b/spec/unit/transaction/resource_harness_spec.rb
@@ -64,49 +64,52 @@ describe Puppet::Transaction::ResourceHarness do
end
end
- describe "when an error occurs" do
- before :each do
- # Create a temporary anonymous class to act as a provider
- stubProvider = Class.new(Puppet::Type)
- stubProvider.instance_eval do
- initvars
-
- newparam(:name) do
- desc "The name var"
- isnamevar
- end
+ def make_stub_provider
+ stubProvider = Class.new(Puppet::Type)
+ stubProvider.instance_eval do
+ initvars
+
+ newparam(:name) do
+ desc "The name var"
+ isnamevar
+ end
- newproperty(:foo) do
- desc "A property that can be changed successfully"
- def sync
- end
+ newproperty(:foo) do
+ desc "A property that can be changed successfully"
+ def sync
+ end
- def retrieve
- :absent
- end
+ def retrieve
+ :absent
+ end
- def insync?(reference_value)
- false
- end
+ def insync?(reference_value)
+ false
end
+ end
- newproperty(:bar) do
- desc "A property that raises an exception when you try to change it"
- def sync
- raise ZeroDivisionError.new('bar')
- end
+ newproperty(:bar) do
+ desc "A property that raises an exception when you try to change it"
+ def sync
+ raise ZeroDivisionError.new('bar')
+ end
- def retrieve
- :absent
- end
+ def retrieve
+ :absent
+ end
- def insync?(reference_value)
- false
- end
+ def insync?(reference_value)
+ false
end
end
+ end
+ stubProvider
+ end
- resource = stubProvider.new :name => 'name', :foo => 1, :bar => 2
+ describe "when an error occurs" do
+ before :each do
+ stub_provider = make_stub_provider
+ resource = stub_provider.new :name => 'name', :foo => 1, :bar => 2
resource.expects(:err).never
@status = @harness.evaluate(resource)
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list