diff options
author | Daniel DeLeo <dan@opscode.com> | 2011-12-05 16:30:48 -0800 |
---|---|---|
committer | Daniel DeLeo <dan@opscode.com> | 2011-12-05 16:30:48 -0800 |
commit | ae2615a898a2a9763affcd98546ef6a54cdf4936 (patch) | |
tree | c8b47e0056aec86787c73843438692864983a878 | |
parent | 86243e215819c8999ff08219f4d0a0fd7db932dc (diff) | |
download | mixlib-shellout-ae2615a898a2a9763affcd98546ef6a54cdf4936.tar.gz |
always grab a random pwent instead of using getlogin
-rw-r--r-- | spec/mixlib/shellout/shellout_spec.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/spec/mixlib/shellout/shellout_spec.rb b/spec/mixlib/shellout/shellout_spec.rb index fc3d69d..cc896e0 100644 --- a/spec/mixlib/shellout/shellout_spec.rb +++ b/spec/mixlib/shellout/shellout_spec.rb @@ -64,16 +64,12 @@ describe Mixlib::ShellOut do it "computes the uid of the user when a string/symbolic username is given" do unless windows? - if username = Etc.getlogin - expected_uid = Etc.getpwuid.uid - else - user_struct = Etc.getpwent - username = user_struct.name - expected_uid = user_struct.uid - end + user_struct = Etc.getpwent + username = user_struct.name + expected_uid = user_struct.uid - @shell_cmd.user = Etc.getlogin - @shell_cmd.uid.should == Etc.getpwuid.uid + @shell_cmd.user = username + @shell_cmd.uid.should == expected_uid end end |