Sha256: 04d1c6a0e66caca3a0da48d64ca31d126cda39dcffe15d3c4d88b1fa93769254

Contents?: true

Size: 910 Bytes

Versions: 72

Compression:

Stored size: 910 Bytes

Contents

#! /usr/bin/env ruby

require 'spec_helper'

describe "id fact" do
  include FacterSpec::ConfigHelper

  kernel = [ 'Linux', 'Darwin', 'windows', 'FreeBSD', 'OpenBSD', 'NetBSD', 'AIX', 'HP-UX' ]

  kernel.each do |k|
    describe "with kernel reported as #{k}" do
      it "should return the current user" do
        given_a_configuration_of(:is_windows => k == 'windows')
        Facter.fact(:kernel).stubs(:value).returns(k)
        Facter::Core::Execution.expects(:execute).once.with('whoami', anything).returns 'bar'

        Facter.fact(:id).value.should == 'bar'
      end
    end
  end

  it "should return the current user on Solaris" do
    given_a_configuration_of(:is_windows => false)
    Facter.fact(:kernel).stubs(:value).returns 'SunOS'
    Facter::Core::Execution.expects(:execute).once.with('/usr/xpg4/bin/id -un', anything).returns 'bar'

    Facter.fact(:id).value.should == 'bar'
  end
end

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
facter-2.5.7 spec/unit/id_spec.rb
facter-2.5.7-x86-mingw32 spec/unit/id_spec.rb
facter-2.5.7-x64-mingw32 spec/unit/id_spec.rb
facter-2.5.7-universal-darwin spec/unit/id_spec.rb
facter-2.5.6-x86-mingw32 spec/unit/id_spec.rb
facter-2.5.6-x64-mingw32 spec/unit/id_spec.rb
facter-2.5.6-universal-darwin spec/unit/id_spec.rb
facter-2.5.6 spec/unit/id_spec.rb
facter-2.5.5-x86-mingw32 spec/unit/id_spec.rb
facter-2.5.5-x64-mingw32 spec/unit/id_spec.rb
facter-2.5.5-universal-darwin spec/unit/id_spec.rb
facter-2.5.5 spec/unit/id_spec.rb
facter-2.5.4-x86-mingw32 spec/unit/id_spec.rb
facter-2.5.4-x64-mingw32 spec/unit/id_spec.rb
facter-2.5.4-universal-darwin spec/unit/id_spec.rb
facter-2.5.4 spec/unit/id_spec.rb
facter-2.5.1 spec/unit/id_spec.rb
facter-2.5.1-x86-mingw32 spec/unit/id_spec.rb
facter-2.5.1-x64-mingw32 spec/unit/id_spec.rb
facter-2.5.1-universal-darwin spec/unit/id_spec.rb