diff options
author | sersut <serdar@opscode.com> | 2013-06-19 15:57:23 -0700 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-06-19 15:57:23 -0700 |
commit | a03e656e7c8e1a4b86e259160ff650f3f15755b3 (patch) | |
tree | a67e50162d18cddb0b4d0ed58eeb7da6b5864683 /spec | |
parent | 1fc625aabd64d2023b426d66c39f17b9a837ff8e (diff) | |
download | mixlib-shellout-a03e656e7c8e1a4b86e259160ff650f3f15755b3.tar.gz |
Fix password and fd cleanup related specs on windows.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/mixlib/shellout_spec.rb | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb index bc043bc..0d7e7f6 100644 --- a/spec/mixlib/shellout_spec.rb +++ b/spec/mixlib/shellout_spec.rb @@ -317,7 +317,7 @@ describe Mixlib::ShellOut do end context 'with options' do - let(:options) { {:cwd => '/tmp', :user => 'nobody'} } + let(:options) { {:cwd => '/tmp', :user => 'nobody', :password => "something"} } it "should set the command to the array of command and args" do shell_cmd.command.should eql(cmd) @@ -427,13 +427,21 @@ describe Mixlib::ShellOut do end end - context "when user is set to Administrator" do - let(:user) { 'administrator' } - let(:domain) { ENV['COMPUTERNAME'].downcase } - let(:options) { { :domain => domain, :user => user, :password => 'vagrant' } } + context "when user is specified" do + before do + system("net user #{user} #{password} /add") + end - it "should run as Administrator" do - running_user.should eql("#{domain}\\#{user}") + after do + system("net user #{user} /delete") + end + + let(:user) { 'testuser' } + let(:password) { 'testpassword' } + let(:options) { { :user => user, :password => password } } + + it "should run as specified user" do + running_user.should eql("#{ENV['COMPUTERNAME'].downcase}\\#{user}") end end end @@ -1023,7 +1031,7 @@ describe Mixlib::ShellOut do end end - describe "#clean_parent_file_descriptors" do + describe "#clean_parent_file_descriptors", :unix_only do # test for for_fd returning a valid File object, but close # throwing EBADF. it "should not throw an exception if fd.close throws EBADF" do |