summaryrefslogtreecommitdiff
path: root/spec/mixlib/shellout_spec.rb
diff options
context:
space:
mode:
authorkaustubh-d <kaustubh@clogeny.com>2014-08-19 15:45:46 +0530
committerJulian C. Dunn <jdunn@getchef.com>2014-08-27 13:13:14 -0400
commit3b389790688adb1007b33476ec2e2b6111e26d76 (patch)
tree230f505bfdc3daa704966db8ef2c342111d994fb /spec/mixlib/shellout_spec.rb
parent7070c0b3807a68cf56b0f38b21f7e0600d972dfb (diff)
downloadmixlib-shellout-3b389790688adb1007b33476ec2e2b6111e26d76.tar.gz
aix does not allow resetting real uid once the euid is changed to non-root.
Diffstat (limited to 'spec/mixlib/shellout_spec.rb')
-rw-r--r--spec/mixlib/shellout_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb
index dca66ae..e009dd8 100644
--- a/spec/mixlib/shellout_spec.rb
+++ b/spec/mixlib/shellout_spec.rb
@@ -1319,4 +1319,25 @@ describe Mixlib::ShellOut do
end
end
end
+
+ context "when running under *nix", :requires_root, :unix_only do
+ let(:cmd) { 'whoami' }
+ let(:running_user) { shell_cmd.run_command.stdout.chomp }
+
+ context "when no user is set" do
+ it "should run as current user" do
+ running_user.should eql(ENV["USER"])
+ end
+ end
+
+ context "when user is specified" do
+ let(:user) { 'nobody' }
+
+ let(:options) { { :user => user } }
+
+ it "should run as specified user" do
+ running_user.should eql("#{user}")
+ end
+ end
+ end
end