[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:20:59 UTC 2009
The following commit has been merged in the master branch:
commit 8d5ded09b9c9c944695c015e6e95b10ccebd6fb5
Author: Luke Kanies <luke at madstop.com>
Date: Tue Sep 23 14:52:57 2008 -0500
Removing some code in Parameter that is unnecessary.
It's duplicated in Property, but was only ever called if
the instance was Property -- in other words, the base class
new about its subclass, but the subclass overrode that method
any way.
Signed-off-by: Luke Kanies <luke at madstop.com>
diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index ef7f1c1..f90193f 100644
--- a/lib/puppet/parameter.rb
+++ b/lib/puppet/parameter.rb
@@ -419,11 +419,6 @@ class Puppet::Parameter
# late-binding (e.g., users might not exist when the value is assigned
# but might when it is asked for).
def value=(value)
- # If we're a parameter, just hand the processing off to the should
- # method.
- if self.is_a?(Puppet::Property)
- return self.should = value
- end
if respond_to?(:validate)
validate(value)
end
diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index 913f439..50a1b71 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -446,7 +446,8 @@ class Property < Puppet::Parameter
self.should
end
- # Provide a common hook for setting @should, just like params.
+ # Match the Parameter interface, but we really just use 'should' internally.
+ # Note that the should= method does all of the validation and such.
def value=(value)
self.should = value
end
diff --git a/spec/unit/property.rb b/spec/unit/property.rb
index a562f8b..e5b1e00 100755
--- a/spec/unit/property.rb
+++ b/spec/unit/property.rb
@@ -5,6 +5,17 @@ require File.dirname(__FILE__) + '/../spec_helper'
require 'puppet/property'
describe Puppet::Property do
+ describe "when setting the value" do
+ it "should just set the 'should' value" do
+ @class = Class.new(Puppet::Property)
+ @class.initvars
+ @property = @class.new :resource => mock('resource')
+
+ @property.expects(:should=).with("foo")
+ @property.value = "foo"
+ end
+ end
+
describe "when returning the value" do
before do
@class = Class.new(Puppet::Property)
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list