Sha256: bdea1e8038a9eaaa18a5f0dea3b8ca41e8fcd02b17d2fb3a1bce9cebe15f5440

Contents?: true

Size: 1.63 KB

Versions: 3

Compression:

Stored size: 1.63 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/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/hieradata'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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