summaryrefslogtreecommitdiffstats
path: root/spec/integration/util
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-12-12 17:55:54 -0600
committerLuke Kanies <luke@madstop.com>2008-12-18 11:10:23 -0600
commit352d7be1a2d3ec6a5930aa4c19c5451e63fdab2e (patch)
tree7868a582feb2f6d707a164034bc91f695e251af3 /spec/integration/util
parent91ff7c1f9c591936b0d39349baf0d1602a69923b (diff)
downloadpuppet-352d7be1a2d3ec6a5930aa4c19c5451e63fdab2e.tar.gz
puppet-352d7be1a2d3ec6a5930aa4c19c5451e63fdab2e.tar.xz
puppet-352d7be1a2d3ec6a5930aa4c19c5451e63fdab2e.zip
Refactoring the Settings class to use Puppet::Resource
It also now uses the Catalog instead of the recursive TransObject stuff. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/integration/util')
-rwxr-xr-xspec/integration/util/settings.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/integration/util/settings.rb b/spec/integration/util/settings.rb
new file mode 100755
index 000000000..a78046462
--- /dev/null
+++ b/spec/integration/util/settings.rb
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+
+require File.dirname(__FILE__) + '/../../spec_helper'
+
+describe Puppet::Util::Settings do
+ def tmpfile(name)
+ source = Tempfile.new(name)
+ source.close!
+ source.path
+ end
+
+ it "should be able to make needed directories" do
+ settings = Puppet::Util::Settings.new
+ settings.setdefaults :main, :maindir => [tmpfile("main"), "a"]
+
+ settings.use(:main)
+
+ File.should be_directory(settings[:maindir])
+ end
+
+ it "should make its directories with the corret modes" do
+ settings = Puppet::Util::Settings.new
+ settings.setdefaults :main, :maindir => {:default => tmpfile("main"), :desc => "a", :mode => 0750}
+
+ settings.use(:main)
+
+ (File.stat(settings[:maindir]).mode & 007777).should == 0750
+ end
+end