summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/util/settings.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index 620c04009..02800933c 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -102,6 +102,19 @@ describe Puppet::Util::Settings, " when setting values" do
values.should == %w{something}
end
+ it "should provide an option to call passed blocks during definition" do
+ values = []
+ @settings.setdefaults(:section, :hooker => {:default => "yay", :desc => "boo", :call_on_define => true, :hook => lambda { |v| values << v }})
+ values.should == %w{yay}
+ end
+
+ it "should pass the fully interpolated value to the hook when called on definition" do
+ values = []
+ @settings.setdefaults(:section, :one => ["test", "a"])
+ @settings.setdefaults(:section, :hooker => {:default => "$one/yay", :desc => "boo", :call_on_define => true, :hook => lambda { |v| values << v }})
+ values.should == %w{test/yay}
+ end
+
it "should munge values using the element-specific methods" do
@settings[:bool] = "false"
@settings[:bool].should == false