summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/parameter.rb5
-rw-r--r--lib/puppet/property.rb3
-rwxr-xr-xspec/unit/property.rb11
3 files changed, 13 insertions, 6 deletions
diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index ef7f1c1ad..f90193fc8 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 913f43977..50a1b71de 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 a562f8bb4..e5b1e0013 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)