Sha256: 340ece44ba5067786d6c7ebb86a097b6ab845d96a3927c39ac5b7fdb12f46e98
Contents?: true
Size: 894 Bytes
Versions: 14
Compression:
Stored size: 894 Bytes
Contents
#!/usr/bin/env rspec require '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
14 entries across 14 versions & 2 rubygems