rspec_approvals 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec_approvals/stream.rb +17 -16
- data/lib/rspec_approvals/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fb4bded8ab248d2bd2826a66f0bbac01188b92614bea48bfb0203f80f118934
|
4
|
+
data.tar.gz: cfaf0bea149ef3926d99f136f291b837756af97dda04d807ce47d55f57dc72a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 041c95b54d4a62f16f0de9fb0502eb482723caca78698e7d9c0d41e5ce42031acbb59ced32bf18524962044ef3baa2daf6db0e07d5802350d13d550bd3cf3d50
|
7
|
+
data.tar.gz: e77f8886c6a274455423a2ee584342a78d89a53536d75419d5965d4013d8f5166c96faadd4aec4e1980d4a0dc80c8a9cb0e1fc33d04048f62170841f911a8d26
|
@@ -6,35 +6,36 @@ module RSpecApprovals
|
|
6
6
|
# These methods are borrowed from rspec's built in matchers
|
7
7
|
# https://github.com/rspec/rspec-expectations/blob/add9b271ecb1d65f7da5bc8a9dd8c64d81d92303/lib/rspec/matchers/built_in/output.rb
|
8
8
|
module Stream
|
9
|
-
module
|
10
|
-
def self.capture(block)
|
9
|
+
module Capture
|
10
|
+
def self.capture(stream, block)
|
11
11
|
RSpecApprovals.stdout.truncate 0
|
12
12
|
RSpecApprovals.stdout.rewind
|
13
|
+
RSpecApprovals.stderr.truncate 0
|
14
|
+
RSpecApprovals.stderr.rewind
|
13
15
|
|
14
|
-
|
16
|
+
stdout_original_stream = $stdout
|
17
|
+
stderr_original_stream = $stderr
|
15
18
|
$stdout = RSpecApprovals.stdout
|
19
|
+
$stderr = RSpecApprovals.stderr
|
16
20
|
block.call
|
17
|
-
RSpecApprovals.
|
21
|
+
RSpecApprovals.send(stream).string.dup
|
18
22
|
|
19
23
|
ensure
|
20
|
-
$stdout =
|
24
|
+
$stdout = stdout_original_stream
|
25
|
+
$stderr = stderr_original_stream
|
21
26
|
|
22
27
|
end
|
23
28
|
end
|
24
29
|
|
25
|
-
module
|
30
|
+
module Stdout
|
26
31
|
def self.capture(block)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
original_stream = $stderr
|
31
|
-
$stderr = RSpecApprovals.stderr
|
32
|
-
block.call
|
33
|
-
RSpecApprovals.stderr.string.dup
|
34
|
-
|
35
|
-
ensure
|
36
|
-
$stderr = original_stream
|
32
|
+
Capture.capture :stdout, block
|
33
|
+
end
|
34
|
+
end
|
37
35
|
|
36
|
+
module Stderr
|
37
|
+
def self.capture(block)
|
38
|
+
Capture.capture :stderr, block
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_approvals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
108
|
+
rubygems_version: 3.2.25
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
111
|
summary: Interactive RSpec Approvals
|