Sha256: 03d422aa0a1b1a5319b152415b04bef6b633aaefd9968411216fccde0dc2df01

Contents?: true

Size: 1.6 KB

Versions: 26

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe Hiera::Util do
  describe 'Hiera::Util.posix?' do
    it 'should return true on posix systems' do
      Etc.expects(:getpwuid).with(0).returns(true)
      Hiera::Util.posix?.should be_true
    end

    it 'should return false on non posix systems' do
      Etc.expects(:getpwuid).with(0).returns(nil)
      Hiera::Util.posix?.should be_false
    end
  end

  describe 'Hiera::Util.microsoft_windows?' do
    it 'should return false on posix systems' do
      Hiera::Util.expects(:file_alt_separator).returns(nil)
      Hiera::Util.microsoft_windows?.should be_false
    end
  end

  describe 'Hiera::Util.config_dir' do
    it 'should return the correct path for posix systems' do
      Hiera::Util.expects(:file_alt_separator).returns(nil)
      Hiera::Util.config_dir.should == '/etc'
    end

    it 'should return the correct path for microsoft windows systems' do
      Hiera::Util.expects(:microsoft_windows?).returns(true)
      Hiera::Util.expects(:common_appdata).returns('C:\\ProgramData')
      Hiera::Util.config_dir.should == 'C:\\ProgramData/PuppetLabs/hiera/etc'
    end
  end

  describe 'Hiera::Util.var_dir' do
    it 'should return the correct path for posix systems' do
      Hiera::Util.expects(:file_alt_separator).returns(nil)
      Hiera::Util.var_dir.should == '/var/lib/hiera'
    end

    it 'should return the correct path for microsoft windows systems' do
      Hiera::Util.expects(:microsoft_windows?).returns(true)
      Hiera::Util.expects(:common_appdata).returns('C:\\ProgramData')
      Hiera::Util.var_dir.should == 'C:\\ProgramData/PuppetLabs/hiera/var'
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
hiera-1.3.4 spec/unit/util_spec.rb
hiera-1.3.3 spec/unit/util_spec.rb
hiera-1.3.2 spec/unit/util_spec.rb
hiera-1.3.2.rc2 spec/unit/util_spec.rb
hiera-1.3.2.rc1 spec/unit/util_spec.rb
hiera-1.3.1 spec/unit/util_spec.rb
hiera-1.3.1.rc1 spec/unit/util_spec.rb
hiera-1.3.0 spec/unit/util_spec.rb
hiera-1.3.0.rc2 spec/unit/util_spec.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/hiera-1.1.2/spec/unit/util_spec.rb
hiera-1.2.1 spec/unit/util_spec.rb
hiera-1.2.1.rc1 spec/unit/util_spec.rb
hiera-1.2.0 spec/unit/util_spec.rb
hiera-1.2.0.rc3 spec/unit/util_spec.rb
hiera-1.2.0.rc2 spec/unit/util_spec.rb
hiera-1.2.0.rc1 spec/unit/util_spec.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/hiera-1.1.2/spec/unit/util_spec.rb
hiera-1.1.2 spec/unit/util_spec.rb
hiera-1.1.2.rc2 spec/unit/util_spec.rb
hiera-1.1.2.rc1 spec/unit/util_spec.rb