backspin 0.7.0 → 0.7.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +14 -14
- data/lib/backspin/command_diff.rb +2 -2
- data/lib/backspin/recorder.rb +2 -2
- data/lib/backspin/version.rb +1 -1
- data/lib/backspin.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 803ecdad9628acd396e0d70b1e9e4081c612562f6872af8fa05108a820c61590
|
|
4
|
+
data.tar.gz: 563d3b7e8c413742453971859cf4bb31aeff11dbeee38d5804922ffa150615bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 17aff3cf0ab930e13da63fa427135cde5e41816341d75ca7712662d4feefb4df1d753db983668a57562c9922d2dda4ae5f54d8cc579ce720d0ac9009015740ff
|
|
7
|
+
data.tar.gz: 203e8c9f1158712ae20e64864a20645cf5fad7e3bd79627bf6dfc7d7efa40cd51d5cbd2e5ac037ebe9a9f8c0408c33921f948400435aa023db32da9df9dfa8fc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.1 - 2025-12-02
|
|
4
|
+
* Include result object on VerificationError to make it easier for callers to debug verification errors
|
|
5
|
+
|
|
6
|
+
## 0.7.0 - 2025-08-13
|
|
7
|
+
* Breaking change: `Backspin.run` and `Backspin.capture` now raise an error if verification fails by default. Use `Backspin.configure` to opt-out. https://github.com/rsanheim/backspin/pull/18
|
|
8
|
+
|
|
3
9
|
## 0.6.0 - 2025-08-13
|
|
4
10
|
* Introduce `Backspin.capture` for rspec-less, simpler stdout/stderr testing https://github.com/rsanheim/backspin/pull/17
|
|
5
11
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
backspin (0.7.
|
|
4
|
+
backspin (0.7.1)
|
|
5
5
|
ostruct
|
|
6
6
|
rspec-mocks (~> 3)
|
|
7
7
|
|
|
@@ -10,19 +10,19 @@ GEM
|
|
|
10
10
|
specs:
|
|
11
11
|
ast (2.4.3)
|
|
12
12
|
diff-lcs (1.6.2)
|
|
13
|
-
json (2.
|
|
13
|
+
json (2.16.0)
|
|
14
14
|
language_server-protocol (3.17.0.5)
|
|
15
15
|
lint_roller (1.1.0)
|
|
16
16
|
ostruct (0.6.1)
|
|
17
17
|
parallel (1.27.0)
|
|
18
|
-
parser (3.3.
|
|
18
|
+
parser (3.3.10.0)
|
|
19
19
|
ast (~> 2.4.1)
|
|
20
20
|
racc
|
|
21
|
-
prism (1.
|
|
21
|
+
prism (1.6.0)
|
|
22
22
|
racc (1.8.1)
|
|
23
23
|
rainbow (3.1.1)
|
|
24
24
|
rake (13.3.0)
|
|
25
|
-
regexp_parser (2.
|
|
25
|
+
regexp_parser (2.11.3)
|
|
26
26
|
rspec (3.13.1)
|
|
27
27
|
rspec-core (~> 3.13.0)
|
|
28
28
|
rspec-expectations (~> 3.13.0)
|
|
@@ -36,7 +36,7 @@ GEM
|
|
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
37
37
|
rspec-support (~> 3.13.0)
|
|
38
38
|
rspec-support (3.13.4)
|
|
39
|
-
rubocop (1.
|
|
39
|
+
rubocop (1.81.7)
|
|
40
40
|
json (~> 2.3)
|
|
41
41
|
language_server-protocol (~> 3.17.0.2)
|
|
42
42
|
lint_roller (~> 1.1.0)
|
|
@@ -44,10 +44,10 @@ GEM
|
|
|
44
44
|
parser (>= 3.3.0.2)
|
|
45
45
|
rainbow (>= 2.2.2, < 4.0)
|
|
46
46
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
47
|
-
rubocop-ast (>= 1.
|
|
47
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
48
48
|
ruby-progressbar (~> 1.7)
|
|
49
49
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
50
|
-
rubocop-ast (1.
|
|
50
|
+
rubocop-ast (1.48.0)
|
|
51
51
|
parser (>= 3.3.7.2)
|
|
52
52
|
prism (~> 1.4)
|
|
53
53
|
rubocop-performance (1.25.0)
|
|
@@ -55,10 +55,10 @@ GEM
|
|
|
55
55
|
rubocop (>= 1.75.0, < 2.0)
|
|
56
56
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
57
57
|
ruby-progressbar (1.13.0)
|
|
58
|
-
standard (1.
|
|
58
|
+
standard (1.52.0)
|
|
59
59
|
language_server-protocol (~> 3.17.0.2)
|
|
60
60
|
lint_roller (~> 1.0)
|
|
61
|
-
rubocop (~> 1.
|
|
61
|
+
rubocop (~> 1.81.7)
|
|
62
62
|
standard-custom (~> 1.0.0)
|
|
63
63
|
standard-performance (~> 1.8)
|
|
64
64
|
standard-custom (1.0.2)
|
|
@@ -68,9 +68,9 @@ GEM
|
|
|
68
68
|
lint_roller (~> 1.1)
|
|
69
69
|
rubocop-performance (~> 1.25.0)
|
|
70
70
|
timecop (0.9.10)
|
|
71
|
-
unicode-display_width (3.
|
|
72
|
-
unicode-emoji (~> 4.
|
|
73
|
-
unicode-emoji (4.0
|
|
71
|
+
unicode-display_width (3.2.0)
|
|
72
|
+
unicode-emoji (~> 4.1)
|
|
73
|
+
unicode-emoji (4.1.0)
|
|
74
74
|
|
|
75
75
|
PLATFORMS
|
|
76
76
|
arm64-darwin-24
|
|
@@ -84,4 +84,4 @@ DEPENDENCIES
|
|
|
84
84
|
timecop (~> 0.9)
|
|
85
85
|
|
|
86
86
|
BUNDLED WITH
|
|
87
|
-
|
|
87
|
+
4.0.0.beta2
|
|
@@ -68,11 +68,11 @@ module Backspin
|
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
def stdout_diff
|
|
71
|
-
"stdout
|
|
71
|
+
"[stdout]\n#{generate_line_diff(recorded_command.stdout, actual_command.stdout)}"
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
def stderr_diff
|
|
75
|
-
"stderr
|
|
75
|
+
"[stderr]\n#{generate_line_diff(recorded_command.stderr, actual_command.stderr)}"
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def generate_line_diff(expected, actual)
|
data/lib/backspin/recorder.rb
CHANGED
|
@@ -10,6 +10,7 @@ module Backspin
|
|
|
10
10
|
# Handles stubbing and recording of command executions
|
|
11
11
|
class Recorder
|
|
12
12
|
include RSpec::Mocks::ExampleMethods
|
|
13
|
+
|
|
13
14
|
SUPPORTED_COMMAND_TYPES = %i[capture3 system].freeze
|
|
14
15
|
|
|
15
16
|
attr_reader :commands, :mode, :record, :matcher, :filter
|
|
@@ -153,7 +154,6 @@ module Backspin
|
|
|
153
154
|
$stdout.reopen(stdout_tempfile)
|
|
154
155
|
$stderr.reopen(stderr_tempfile)
|
|
155
156
|
|
|
156
|
-
# Execute the block
|
|
157
157
|
result = yield
|
|
158
158
|
|
|
159
159
|
# Flush and read captured output
|
|
@@ -168,7 +168,7 @@ module Backspin
|
|
|
168
168
|
# Create a single command representing all captured output
|
|
169
169
|
command = Command.new(
|
|
170
170
|
method_class: Backspin::Capturer,
|
|
171
|
-
args: [
|
|
171
|
+
args: [],
|
|
172
172
|
stdout: captured_stdout,
|
|
173
173
|
stderr: captured_stderr,
|
|
174
174
|
status: 0,
|
data/lib/backspin/version.rb
CHANGED
data/lib/backspin.rb
CHANGED
|
@@ -19,7 +19,26 @@ require "backspin/record_result"
|
|
|
19
19
|
module Backspin
|
|
20
20
|
class RecordNotFoundError < StandardError; end
|
|
21
21
|
|
|
22
|
-
class VerificationError < StandardError
|
|
22
|
+
class VerificationError < StandardError
|
|
23
|
+
attr_reader :result
|
|
24
|
+
|
|
25
|
+
def initialize(message, result: nil)
|
|
26
|
+
super(message)
|
|
27
|
+
@result = result
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def diff
|
|
31
|
+
result.diff
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def recorded_commands
|
|
35
|
+
result.command_diffs.map(&:recorded_command)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def actual_commands
|
|
39
|
+
result.command_diffs.map(&:actual_command)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
23
42
|
|
|
24
43
|
# Include RSpec mocks methods
|
|
25
44
|
extend RSpec::Mocks::ExampleMethods
|
|
@@ -176,7 +195,7 @@ module Backspin
|
|
|
176
195
|
error_message += "\n\nDiff:\n#{result.diff}"
|
|
177
196
|
end
|
|
178
197
|
|
|
179
|
-
raise VerificationError,
|
|
198
|
+
raise VerificationError.new(error_message, result: result)
|
|
180
199
|
end
|
|
181
200
|
|
|
182
201
|
result
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: backspin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rob Sanheim
|
|
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
154
154
|
- !ruby/object:Gem::Version
|
|
155
155
|
version: '0'
|
|
156
156
|
requirements: []
|
|
157
|
-
rubygems_version: 3.
|
|
157
|
+
rubygems_version: 3.7.2
|
|
158
158
|
specification_version: 4
|
|
159
159
|
summary: Record and replay CLI interactions for testing
|
|
160
160
|
test_files: []
|