serverspec 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,11 @@ module Serverspec
|
|
24
24
|
|
25
25
|
def add_pre_command(cmd)
|
26
26
|
cmd = super(cmd)
|
27
|
-
|
27
|
+
user = RSpec.configuration.ssh.options[:user]
|
28
|
+
pre_command = Serverspec.configuration.pre_command
|
29
|
+
if pre_command && user != 'root'
|
30
|
+
cmd = "sudo #{cmd}"
|
31
|
+
end
|
28
32
|
cmd
|
29
33
|
end
|
30
34
|
|
data/lib/serverspec/version.rb
CHANGED
@@ -61,6 +61,20 @@ describe 'pre_command is set and user is non-root' do
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
+
describe 'pre_command is not set and user is non-root' do
|
65
|
+
before :all do
|
66
|
+
RSpec.configure do |c|
|
67
|
+
ssh.stub(:options) { { :user => 'foo' } }
|
68
|
+
c.ssh = ssh
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context package('httpd') do
|
73
|
+
its(:command) { should eq 'sudo command' }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
|
64
78
|
describe 'path pre_command and set and user is non-root' do
|
65
79
|
before :all do
|
66
80
|
RSpec.configure do |c|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -354,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
354
|
version: '0'
|
355
355
|
requirements: []
|
356
356
|
rubyforge_project:
|
357
|
-
rubygems_version: 1.8.
|
357
|
+
rubygems_version: 1.8.25
|
358
358
|
signing_key:
|
359
359
|
specification_version: 3
|
360
360
|
summary: RSpec tests for your servers provisioned by Puppet, Chef or anything else
|