serverspec 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
|
|
1
1
|
RSpec::Matchers.define :be_running do
|
2
|
-
match do |
|
3
|
-
ret = ssh_exec(commands.check_running(
|
4
|
-
if ret[:exit_code] == 1
|
5
|
-
ret = ssh_exec(commands.check_process(
|
2
|
+
match do |process|
|
3
|
+
ret = ssh_exec(commands.check_running(process))
|
4
|
+
if ret[:exit_code] == 1 || ret[:stdout] =~ /stopped/
|
5
|
+
ret = ssh_exec(commands.check_process(process))
|
6
6
|
end
|
7
7
|
ret[:exit_code] == 0
|
8
8
|
end
|
data/lib/serverspec/version.rb
CHANGED
@@ -32,6 +32,15 @@ shared_examples_for 'support be_running matcher' do |valid_service|
|
|
32
32
|
describe 'this-is-invalid-daemon' do
|
33
33
|
it { should_not be_running }
|
34
34
|
end
|
35
|
+
|
36
|
+
describe valid_service do
|
37
|
+
before :all do
|
38
|
+
RSpec.configure do |c|
|
39
|
+
c.stdout = "#{valid_service} is stopped\r\n"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
it { should be_running }
|
43
|
+
end
|
35
44
|
end
|
36
45
|
end
|
37
46
|
|