summaryrefslogtreecommitdiffstats
path: root/spec/integration/util/settings.rb
blob: 536eab64386ffb4483991573942fbe8d4270c9aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env ruby

require File.dirname(__FILE__) + '/../../spec_helper'

require 'puppet_spec/files'

describe Puppet::Util::Settings do
    include PuppetSpec::Files

    def minimal_default_settings
        { :noop => {:default => false, :desc => "noop"} }
    end

    it "should be able to make needed directories" do
        settings = Puppet::Util::Settings.new
        settings.setdefaults :main, minimal_default_settings.update( :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,  minimal_default_settings.update( :maindir => {:default => tmpfile("main"), :desc => "a", :mode => 0750} )

        settings.use(:main)

        (File.stat(settings[:maindir]).mode & 007777).should == 0750
    end
end