Sha256: 77a2ee497c31c7e8a82d6fe336674eac304d247eb5a39273c55600f0d95de123

Contents?: true

Size: 1.63 KB

Versions: 19

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby

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

describe Puppet::Util::RunMode do
  before do
    @run_mode = Puppet::Util::RunMode.new('fake')
  end

  it "should have confdir /etc/puppet when run as root" do
    Puppet.features.stubs(:root?).returns(true)
    @run_mode.conf_dir.should == '/etc/puppet'
  end

  it "should have confdir ~/.puppet when run as non-root" do
    Puppet.features.stubs(:root?).returns(false)
    @run_mode.expects(:expand_path).with("~/.puppet").returns("~/.puppet")
    @run_mode.conf_dir.should == "~/.puppet"
  end

  it "should have vardir /var/lib/puppet when run as root" do
    Puppet.features.stubs(:root?).returns(true)
    @run_mode.var_dir.should == '/var/lib/puppet'
  end

  it "should have vardir ~/.puppet/var when run as non-root" do
    Puppet.features.stubs(:root?).returns(false)
    @run_mode.expects(:expand_path).with("~/.puppet/var").returns("~/.puppet/var")
    @run_mode.var_dir.should == "~/.puppet/var"
  end

  it "should have rundir depend on vardir" do
    @run_mode.run_dir.should == '$vardir/run'
  end

  it "should have logopts return an array with $vardir/log if runmode is not master" do
    @run_mode.expects(:master?).returns false
    @run_mode.logopts.should == ["$vardir/log", "The Puppet log directory."]
  end

  it "should have logopts return a hash with $vardir/log and other metadata if runmode is master" do
    @run_mode.expects(:master?).returns true
    @run_mode.logopts.should == {
      :default => "$vardir/log",
      :mode    => 0750,
      :owner   => "service",
      :group   => "service",
      :desc    => "The Puppet log directory.",
    }
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
puppet-2.6.18 spec/unit/util/run_mode_spec.rb
puppet-2.6.17 spec/unit/util/run_mode_spec.rb
puppet-2.6.16 spec/unit/util/run_mode_spec.rb
puppet-2.6.15 spec/unit/util/run_mode_spec.rb
puppet-2.6.14 spec/unit/util/run_mode_spec.rb
puppet-2.6.13 spec/unit/util/run_mode_spec.rb
puppet-2.6.12 spec/unit/util/run_mode_spec.rb
puppet-2.6.11 spec/unit/util/run_mode_spec.rb
puppet-2.6.10 spec/unit/util/run_mode_spec.rb
puppet-2.6.9 spec/unit/util/run_mode_spec.rb
puppet-2.6.8 spec/unit/util/run_mode_spec.rb
puppet-2.6.7 spec/unit/util/run_mode_spec.rb
puppet-2.6.6 spec/unit/util/run_mode_spec.rb
puppet-2.6.5 spec/unit/util/run_mode_spec.rb
puppet-2.6.4 spec/unit/util/run_mode_spec.rb
puppet-2.6.3 spec/unit/util/run_mode_spec.rb
puppet-2.6.2 spec/unit/util/run_mode_spec.rb
puppet-2.6.1 spec/unit/util/run_mode_spec.rb
puppet-2.6.0 spec/unit/util/run_mode_spec.rb