Sha256: 27be7ddae8fb26a391f287fe52ec8d4a1b51d6a89e922be95ea6e378c0a89a4c
Contents?: true
Size: 1010 Bytes
Versions: 2
Compression:
Stored size: 1010 Bytes
Contents
#!/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.fact(:kernel).stubs(:value).returns(k) Facter::Util::Config.stubs(:is_windows?).returns(k == 'windows') Facter::Util::Resolution.expects(:exec).once.with('whoami').returns 'bar' Facter.fact(:id).value.should == 'bar' end end end it "should return the current user on Solaris" do Facter::Util::Config.stubs(:is_windows?).returns(false) Facter::Util::Resolution.stubs(:exec).with('uname -s').returns('SunOS') Facter::Util::Resolution.expects(:exec).once.with('/usr/xpg4/bin/id -un').returns 'bar' Facter.fact(:id).value.should == 'bar' end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
facter-1.6.2 | spec/unit/id_spec.rb |
facter-1.6.1 | spec/unit/id_spec.rb |