serverspec 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,11 @@ module Serverspec
24
24
 
25
25
  def add_pre_command(cmd)
26
26
  cmd = super(cmd)
27
- cmd = "sudo #{cmd}" if RSpec.configuration.ssh.options[:user] != 'root'
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
 
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "0.5.6"
2
+ VERSION = "0.5.7"
3
3
  end
@@ -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.6
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-10 00:00:00.000000000 Z
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.23
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