Sha256: df74db800965cd65c7c5afd48140c42efe5ef0af982bc4f25a09d17520e51be2

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 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/puppetlabs/code'
    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/code'
    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 == '/etc/puppetlabs/code/environments/%{environment}/hieradata'
    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/code/environments/%{environment}/hieradata'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hiera-3.0.1 spec/unit/util_spec.rb
hiera-3.0.1-x86-mingw32 spec/unit/util_spec.rb
hiera-3.0.1-x64-mingw32 spec/unit/util_spec.rb