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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f6f79191389f6f6f78661b402a1fa776534e37d87292471b708d0eb338779e6
4
- data.tar.gz: 25c8091f368074e45c9f091a0beec04abaf3e5d5e883e3c6ed4d417ac8c2a349
3
+ metadata.gz: 803ecdad9628acd396e0d70b1e9e4081c612562f6872af8fa05108a820c61590
4
+ data.tar.gz: 563d3b7e8c413742453971859cf4bb31aeff11dbeee38d5804922ffa150615bb
5
5
  SHA512:
6
- metadata.gz: 7f4e22608a611ee37a698f53b6959c74443272d30dd83fbe812abb80e73b068035c09873754ea7dad1289b056f2fed3c35e09c8c19944df87544268caaaeb490
7
- data.tar.gz: e1313ad87c03e01386c6ede54ac706acf556c4667359c7c081cb60191dafa2c53a0ca5c8a58a0e8e01fe5028af7664077eda83f56fdd2c66cfa5b31bb04f0174
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.0)
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.12.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.8.0)
18
+ parser (3.3.10.0)
19
19
  ast (~> 2.4.1)
20
20
  racc
21
- prism (1.4.0)
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.10.0)
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.75.8)
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.44.0, < 2.0)
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.45.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.50.0)
58
+ standard (1.52.0)
59
59
  language_server-protocol (~> 3.17.0.2)
60
60
  lint_roller (~> 1.0)
61
- rubocop (~> 1.75.5)
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.1.4)
72
- unicode-emoji (~> 4.0, >= 4.0.4)
73
- unicode-emoji (4.0.4)
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
- 2.6.9
87
+ 4.0.0.beta2
@@ -68,11 +68,11 @@ module Backspin
68
68
  end
69
69
 
70
70
  def stdout_diff
71
- "stdout diff:\n#{generate_line_diff(recorded_command.stdout, actual_command.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 diff:\n#{generate_line_diff(recorded_command.stderr, actual_command.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)
@@ -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: ["<captured block>"],
171
+ args: [],
172
172
  stdout: captured_stdout,
173
173
  stderr: captured_stderr,
174
174
  status: 0,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Backspin
4
- VERSION = "0.7.0"
4
+ VERSION = "0.7.1"
5
5
  end
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; end
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, error_message
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.0
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.6.9
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: []