Sha256: 4531588613b352ca2efe3de8e2ad723a35a9a3344228682a29ec498dc8879b48
Contents?: true
Size: 940 Bytes
Versions: 12
Compression:
Stored size: 940 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
12 entries across 12 versions & 2 rubygems