shell_mock 0.3.2 → 0.3.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d5ceba79882bc6462a68ab77bbad02307c16276
4
- data.tar.gz: ab8ccdcbc115e071b30ed72881d44729449f7a6f
3
+ metadata.gz: 25b8d6ab592753360667373eb0864fcdf8717299
4
+ data.tar.gz: c6927a9111c84a6cfb60354ea7538694901e56eb
5
5
  SHA512:
6
- metadata.gz: 50b1ef01eebf65f57c1580c8cd8094b344d49eaef4028fe5ef2d21912a0256470a950175f82c405f8b6718f8e4db6ca355ee9445e39ffe7d8d12b15d04d6df54
7
- data.tar.gz: 08ca65ddda554c935a55c53c8c5796014826e91de33146e9ce7415262a1baabfd2c9e1a41ab68333842db5c9ec34ab180febd6c1ad0a0ba096600c1552d67957
6
+ metadata.gz: cada1b891f0d799db477929e60991353e27d9b6e289ee9b781962b1f8bcba49f0f6c25347f00f2710c8ca4808025ea72a7aeea5a50765f6a1ac0c49d3353bd4f
7
+ data.tar.gz: dcc0f0a6a7c59f6bf7067c08553d36db785ec0f6165bfeaef623e40487993190d2e6b27552ceaea38e7d5cd5242c5225407c31a14195c2cf84c1a950ffe78448
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  * add `with_side_effect(&blk)` for specifying desired side effects
4
4
 
5
+ ## RELEASE 0.3.3
6
+
7
+ * FIX: `exec`'d calls now registered as having been called
8
+
5
9
  ## RELEASE 0.3.2
6
10
 
7
11
  * FIX: fixed patched `exec`'s handling of exit statuses
@@ -1,8 +1,9 @@
1
1
  require 'shell_mock/call_verifier'
2
+ require 'shell_mock/stub_registry'
2
3
 
3
4
  module ShellMock
4
5
  class CommandStub
5
- attr_reader :command, :expected_output, :exitstatus, :env, :options, :side_effect
6
+ attr_reader :command, :expected_output, :exitstatus, :env, :options, :side_effect, :writer
6
7
 
7
8
  def initialize(command)
8
9
  @command = command
@@ -10,6 +11,8 @@ module ShellMock
10
11
  @options = {}
11
12
  @side_effect = proc {}
12
13
  @exitstatus = 0
14
+
15
+ @reader, @writer = IO.pipe
13
16
  end
14
17
 
15
18
  def with_env(env)
@@ -39,10 +42,36 @@ module ShellMock
39
42
 
40
43
  def calls
41
44
  @calls ||= []
45
+
46
+ marshaled_signatures.each do |marshaled_signature|
47
+ @calls << Marshal.load(marshaled_signature)
48
+ end
49
+
50
+ @calls
42
51
  end
43
52
 
44
53
  def called_with(env, command, options)
45
- calls << [env, command, options]
54
+ signature = Marshal.dump([env, command, options])
55
+
56
+ writer.puts(signature)
57
+ end
58
+
59
+ private
60
+
61
+ attr_reader :reader
62
+
63
+ def marshaled_signatures
64
+ messages = ""
65
+
66
+ loop do
67
+ begin
68
+ messages += reader.read_nonblock(1)
69
+ rescue IO::WaitReadable
70
+ break
71
+ end
72
+ end
73
+
74
+ messages.split("\n")
46
75
  end
47
76
  end
48
77
  end
@@ -1,3 +1,3 @@
1
1
  module ShellMock
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
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.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hoffman