summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2013-06-20 12:11:35 -0700
committerSerdar Sutay <serdar@opscode.com>2013-06-20 12:11:35 -0700
commite85a89de32ce372249e9d23e7191e77ef41a1da7 (patch)
tree501ec7cb0703338675af21a8e17768dd1a564dc7
parent1fc625aabd64d2023b426d66c39f17b9a837ff8e (diff)
parente1c5bda14fd39e3d5f1d36dde354d69721a31f26 (diff)
downloadmixlib-shellout-e85a89de32ce372249e9d23e7191e77ef41a1da7.tar.gz
Merge pull request #23 from opscode/windows-spec-fixes
This PR fixes mixlib-shellout failures in our CI infrastructure.
-rw-r--r--mixlib-shellout.gemspec1
-rw-r--r--spec/mixlib/shellout_spec.rb30
2 files changed, 18 insertions, 13 deletions
diff --git a/mixlib-shellout.gemspec b/mixlib-shellout.gemspec
index 4c59291..2edc357 100644
--- a/mixlib-shellout.gemspec
+++ b/mixlib-shellout.gemspec
@@ -5,7 +5,6 @@ Gem::Specification.new do |s|
s.name = 'mixlib-shellout'
s.version = Mixlib::ShellOut::VERSION
s.platform = Gem::Platform::RUBY
- s.has_rdoc = true
s.extra_rdoc_files = ["README.md", "LICENSE" ]
s.summary = "Run external commands on Unix or Windows"
s.description = s.summary
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb
index bc043bc..89f21e7 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)
@@ -326,6 +326,7 @@ describe Mixlib::ShellOut do
it "should evaluate the options" do
shell_cmd.cwd.should eql('/tmp')
shell_cmd.user.should eql('nobody')
+ shell_cmd.password.should eql('something')
end
end
end
@@ -419,21 +420,26 @@ describe Mixlib::ShellOut do
# Need to adjust the username and domain if running as local system
# to match how whoami returns the information
- let(:local_system) { (ENV['USERNAME'].downcase == "#{ENV['COMPUTERNAME'].downcase}$") }
- let(:domain) { local_system ? 'nt authority' : ENV['COMPUTERNAME'].downcase }
- let(:user) { local_system ? 'system' : ENV['USERNAME'].downcase }
it "should run as current user" do
- running_user.should eql("#{domain}\\#{user}")
+ running_user.should eql("#{ENV['COMPUTERNAME'].downcase}\\#{ENV['USERNAME'].downcase}")
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").should == true
+ end
+
+ after do
+ system("net user #{user} /delete").should == true
+ end
+
+ let(:user) { 'testuser' }
+ let(:password) { 'testpass1!' }
+ let(:options) { { :user => user, :password => password } }
- it "should run as Administrator" do
- running_user.should eql("#{domain}\\#{user}")
+ it "should run as specified user" do
+ running_user.should eql("#{ENV['COMPUTERNAME'].downcase}\\#{user}")
end
end
end
@@ -1023,7 +1029,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