Sha256: 984de3102b3097691d363b6d7b77477faeec83c4c2b7ccc1761433b5aa5111a5
Contents?: true
Size: 924 Bytes
Versions: 3
Compression:
Stored size: 924 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(:exec).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::Core::Execution.stubs(:exec).with('uname -s').returns('SunOS') Facter::Core::Execution.expects(:exec).once.with('/usr/xpg4/bin/id -un', anything).returns 'bar' Facter.fact(:id).value.should == 'bar' end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
facter-2.0.1.rc2 | spec/unit/id_spec.rb |
facter-2.0.1.rc2-x86-mingw32 | spec/unit/id_spec.rb |
facter-2.0.1.rc2-universal-darwin | spec/unit/id_spec.rb |