shell_mock 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -1
- data/lib/shell_mock/command_stub.rb +9 -3
- data/lib/shell_mock/core_ext/kernel.rb +3 -1
- data/lib/shell_mock/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94f87ea7ae5143765b28504839761f40d6de32ba
|
4
|
+
data.tar.gz: 2670d8e0210da8490d2f13ee539db88d0b11358e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc83af09d87af7dff16cdacf8517ba4306251769daf341fa4fcfcc0420c4a3cd2e8b3bb4d8e6954809e848ff3d8f337c31d38ab8d0aff18e205a6815b7640e56
|
7
|
+
data.tar.gz: 8105e3a20706f32766c708e5c31d29df4a5a528ba1d8f58569e78bcd55b6d37de0cd2db23ca40b9d3bf9e9c71a71a6414af7d853c8769e819a179e84f026322d
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@ require 'shell_mock/call_verifier'
|
|
2
2
|
|
3
3
|
module ShellMock
|
4
4
|
class CommandStub
|
5
|
-
attr_reader :command, :expected_output, :
|
5
|
+
attr_reader :command, :expected_output, :exitstatus
|
6
6
|
|
7
7
|
def initialize(command)
|
8
8
|
@command = command
|
@@ -28,9 +28,15 @@ module ShellMock
|
|
28
28
|
@options || {}
|
29
29
|
end
|
30
30
|
|
31
|
-
def and_return(expected_output
|
31
|
+
def and_return(expected_output)
|
32
32
|
@expected_output = expected_output
|
33
|
-
@
|
33
|
+
@exitstatus ||= 0
|
34
|
+
|
35
|
+
self
|
36
|
+
end
|
37
|
+
|
38
|
+
def and_exit(exitstatus)
|
39
|
+
@exitstatus = exitstatus
|
34
40
|
|
35
41
|
self
|
36
42
|
end
|
@@ -10,9 +10,10 @@ module Kernel
|
|
10
10
|
|
11
11
|
if stub
|
12
12
|
stub.side_effect.call
|
13
|
+
`exit #{stub.exitstatus}`
|
13
14
|
stub.called_with(env, command, options)
|
14
15
|
|
15
|
-
return stub.
|
16
|
+
return stub.exitstatus == 0
|
16
17
|
else
|
17
18
|
if ShellMock.let_commands_run?
|
18
19
|
__un_shell_mocked_system(env, command, **options)
|
@@ -27,6 +28,7 @@ module Kernel
|
|
27
28
|
|
28
29
|
if stub
|
29
30
|
stub.side_effect.call
|
31
|
+
`exit #{stub.exitstatus}`
|
30
32
|
stub.called_with({}, command, {})
|
31
33
|
|
32
34
|
return stub.expected_output
|
data/lib/shell_mock/version.rb
CHANGED