diff options
| author | James Turnbull <james@lovedthanlost.net> | 2011-03-14 13:57:32 +1100 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2011-03-15 11:41:51 +1100 |
| commit | 2e48e189910f75cc1a6586bbecda27ecbd0afc8e (patch) | |
| tree | d9c667853cc7c2c67a8fd0797322a4c1647992c7 /spec/unit | |
| parent | 469d2a26a467c50af9f9732d7f98e8a01ecc369f (diff) | |
| download | facter-2e48e189910f75cc1a6586bbecda27ecbd0afc8e.tar.gz facter-2e48e189910f75cc1a6586bbecda27ecbd0afc8e.tar.xz facter-2e48e189910f75cc1a6586bbecda27ecbd0afc8e.zip | |
Fixed #6695 - Updated id fact for Darwin et al
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/id_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/unit/id_spec.rb b/spec/unit/id_spec.rb new file mode 100755 index 0000000..a9e1797 --- /dev/null +++ b/spec/unit/id_spec.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe "id fact" do + + 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 + Facter::Util::Resolution.stubs(:exec).with('uname -s').returns(k) + Facter::Util::Resolution.stubs(:exec).with('lsb_release -a 2>/dev/null').returns('foo') + Facter::Util::Resolution.expects(:exec).once.with('whoami', '/bin/sh').returns 'bar' + + Facter.fact(:id).value.should == 'bar' + end + end + end + + it "should return the current user on Solaris" do + Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS') + Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un', '/bin/sh').returns 'bar' + + Facter.fact(:id).value.should == 'bar' + end +end |
