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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 160dfa02d4b23e67d61886aecffb53bd916f2f72
4
- data.tar.gz: de591f0065dcae5483cd75d1527b9564a1d22a8a
3
+ metadata.gz: 94f87ea7ae5143765b28504839761f40d6de32ba
4
+ data.tar.gz: 2670d8e0210da8490d2f13ee539db88d0b11358e
5
5
  SHA512:
6
- metadata.gz: 5e9d2edb53f6dc2f931706bf11f3ffe1e9526642e4b8d06b6e9d2355a0de8abc3860e10c3fa53746d4806943b4538529e28dcc411b4f21be4be345369538273c
7
- data.tar.gz: d0d12149d6d206641407d64fc2a6dfd645f669694f7837cacac9803e320d38c98e3945bd5a36550e5a0c1a679c0ede56cb8e9977960a30a1affd31c3c5e4490d
6
+ metadata.gz: cc83af09d87af7dff16cdacf8517ba4306251769daf341fa4fcfcc0420c4a3cd2e8b3bb4d8e6954809e848ff3d8f337c31d38ab8d0aff18e205a6815b7640e56
7
+ data.tar.gz: 8105e3a20706f32766c708e5c31d29df4a5a528ba1d8f58569e78bcd55b6d37de0cd2db23ca40b9d3bf9e9c71a71a6414af7d853c8769e819a179e84f026322d
data/README.md CHANGED
@@ -73,4 +73,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/yarmig
73
73
  ## License
74
74
 
75
75
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
76
-
@@ -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, :return_code
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, return_code: 0)
31
+ def and_return(expected_output)
32
32
  @expected_output = expected_output
33
- @return_code = return_code
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.return_code == 0
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
@@ -1,3 +1,3 @@
1
1
  module ShellMock
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shell_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hoffman