summaryrefslogtreecommitdiffstats
path: root/spec/unit
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-12-10 17:59:51 -0600
committerLuke Kanies <luke@madstop.com>2007-12-10 17:59:51 -0600
commit7a4ae082c216d68092f140ed1f5cca40ffb1a09e (patch)
tree18404a765506d34f959f2e4880939b157eb735a6 /spec/unit
parent3790ce1c6463e0d44ae0151fdc24000b9d5ede27 (diff)
downloadpuppet-7a4ae082c216d68092f140ed1f5cca40ffb1a09e.tar.gz
puppet-7a4ae082c216d68092f140ed1f5cca40ffb1a09e.tar.xz
puppet-7a4ae082c216d68092f140ed1f5cca40ffb1a09e.zip
Fixing the rest of #948. My previous work was sufficient,
except that I was not passing the interpolated value in to the hook, which meant the libdir was set to something like $vardir/lib.
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/util/settings.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb
index ab93d87de..5a0333798 100755
--- a/spec/unit/util/settings.rb
+++ b/spec/unit/util/settings.rb
@@ -382,6 +382,20 @@ describe Puppet::Util::Settings, " when parsing its configuration" do
values.should == ["other"]
end
+ it "should pass the interpolated value to the hook when one is available" do
+ values = []
+ @settings.setdefaults :section, :base => {:default => "yay", :desc => "a", :hook => proc { |v| values << v }}
+ @settings.setdefaults :section, :mysetting => {:default => "defval", :desc => "a", :hook => proc { |v| values << v }}
+
+ text = "[main]
+ mysetting = $base/setval
+ "
+ file = "/some/file"
+ @settings.expects(:read_file).with(file).returns(text)
+ @settings.parse(file)
+ values.should == ["yay/setval"]
+ end
+
it "should allow empty values" do
@settings.setdefaults :section, :myarg => ["myfile", "a"]