summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/mixlib/shellout_spec.rb10
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/support/platform_helpers.rb1
3 files changed, 8 insertions, 5 deletions
diff --git a/spec/mixlib/shellout_spec.rb b/spec/mixlib/shellout_spec.rb
index ceb80d9..ed5e30a 100644
--- a/spec/mixlib/shellout_spec.rb
+++ b/spec/mixlib/shellout_spec.rb
@@ -410,7 +410,8 @@ describe Mixlib::ShellOut do
let(:options) do
{ cwd: cwd, user: user, login: true, domain: domain, password: password, group: group,
umask: umask, timeout: timeout, environment: environment, returns: valid_exit_codes,
- live_stream: stream, input: input } end
+ live_stream: stream, input: input }
+ end
let(:cwd) { "/tmp" }
let(:user) { "toor" }
@@ -635,7 +636,7 @@ describe Mixlib::ShellOut do
# to match how whoami returns the information
it "should run as current user" do
- expect(running_user).to eql("#{ENV['USERDOMAIN'].downcase}\\#{ENV['USERNAME'].downcase}")
+ expect(running_user).to eql("#{ENV["USERDOMAIN"].downcase}\\#{ENV["USERNAME"].downcase}")
end
end
@@ -653,7 +654,7 @@ describe Mixlib::ShellOut do
let(:options) { { user: user, password: password } }
it "should run as specified user" do
- expect(running_user).to eql("#{ENV['COMPUTERNAME'].downcase}\\#{user}")
+ expect(running_user).to eql("#{ENV["COMPUTERNAME"].downcase}\\#{user}")
end
context "when :elevated => true" do
@@ -1514,7 +1515,8 @@ describe Mixlib::ShellOut do
%q{STDERR: msg_in_stderr},
"---- End output of #{cmd} ----",
"Ran #{cmd} returned 0",
- ] end
+ ]
+ end
it "should format exception messages" do
exception_output.each_with_index do |output_line, i|
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 913ee7c..1f3c818 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -8,7 +8,7 @@ require "timeout"
# Load everything from spec/support
# Do not change the gsub.
-Dir["spec/support/**/*.rb"].map { |f| f.gsub(%r{.rb$}, "") }.each { |f| require f }
+Dir["spec/support/**/*.rb"].map { |f| f.gsub(/.rb$/, "") }.each { |f| require f }
RSpec.configure do |config|
config.mock_with :rspec
diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb
index a03a0e0..735cc8f 100644
--- a/spec/support/platform_helpers.rb
+++ b/spec/support/platform_helpers.rb
@@ -16,5 +16,6 @@ end
def root?
return false if windows?
+
Process.euid == 0
end