backspin 0.4.0 → 0.4.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: 59bc6e711951434fc84dd2c2694f69aa5b00ef3bf878b81c5b4e97beeb430ad6
4
- data.tar.gz: f9784962ef86ad73e0eb1c8388217700e477bc60ce0528b5dd16f08bc5c2f637
3
+ metadata.gz: f44a53c1983fd41c2660bc9652c158b2193e880e0e1339fa49c882d26fdd0852
4
+ data.tar.gz: 3b53d9ba92db35ad66c128bc049762e06c307472827fe2d4b795427c7e668bdf
5
5
  SHA512:
6
- metadata.gz: e4151f4a28909e1a80706a30520b268f5114124230df9869a3603d5502194f4885ca8dff19e15a9a8ffe5f559b14695614f9f113c66e82ccc105de5b7ae17006
7
- data.tar.gz: a66f71d1a4b2e9404ca39178920d8b88686f5e8cec2fe62f282b1cda9de031c1041cdfa1007ee9dc725c24cfb1c4dad5445213091a20c0faf23165705a8d264e
6
+ metadata.gz: 28909c63f9befbe8a0ae208328b9c527b3f1ca28417a66e96afad6ee9be41c2fa157ede63e4c5073f049ac59ab9c336a5fde7b97e109b7efc61480942ddc1a58
7
+ data.tar.gz: e63c8c4fff6ac690575ffadfe48efd6b4d0bc2267680e1c99637a888edcf3034bb315d96efedc400bfabdf5f8a9aa7912dfef03771b86a6a69769efe1bdcaac6
data/CLAUDE.md CHANGED
@@ -62,7 +62,7 @@ bin/rake standard # Run Standard Ruby linter
62
62
  ### Testing Approach
63
63
 
64
64
  - Integration-focused tests that exercise the full stack
65
- - Default record directory is `spec/backspin_data` (can be configured)
65
+ - Default record directory is `fixtures/backspin` (can be configured)
66
66
  - Tests use real shell commands (`echo`, `date`, etc.)
67
67
  - Configuration is reset between tests to avoid side effects
68
68
  - **Important**: Backspin specs MUST be as local and un-DRY as possible. Each spec should be self-contained with its own setup, expectations, and cleanup if needed. Avoid shared contexts or helpers that hide important test details.
@@ -76,7 +76,7 @@ bin/rake standard # Run Standard Ruby linter
76
76
  4. Run tests with `rake spec`
77
77
 
78
78
  ### Debugging Tests
79
- - Records are saved to `spec/backspin_data/` by default
79
+ - Records are saved to `fixtures/backspin/` by default
80
80
  - Check YAML files to see recorded command outputs
81
81
 
82
82
  ### Updating Credential Patterns
data/CONTRIBUTING.md CHANGED
@@ -99,7 +99,7 @@ Backspin is a Ruby gem for characterization testing of command-line interfaces.
99
99
 
100
100
  #### Debugging Tests
101
101
 
102
- - Records are saved to `spec/backspin_data/` by default
102
+ - Records are saved to `fixtures/backspin/` by default
103
103
  - Check YAML files to see recorded command outputs
104
104
 
105
105
  ## Testing
@@ -125,7 +125,7 @@ Backspin uses integration-focused tests that exercise the full stack. When writi
125
125
  - Avoid shared contexts or helpers that hide important test details
126
126
  - Use real shell commands (`echo`, `date`, etc.) for testing
127
127
  - Ensure configuration is reset between tests to avoid side effects
128
- - Verify new or updated test records in `spec/backspin_data/`
128
+ - Verify new or updated test records in `fixtures/backspin/`
129
129
 
130
130
  Example test structure:
131
131
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- backspin (0.4.0)
4
+ backspin (0.4.1)
5
5
  ostruct (~> 0.5.0)
6
6
  rspec-mocks (~> 3.0)
7
7
 
data/README.md CHANGED
@@ -1,4 +1,9 @@
1
- # Backspin   [![Gem Version](https://badge.fury.io/rb/backspin.svg)](https://badge.fury.io/rb/backspin) [![CircleCI](https://dl.circleci.com/status-badge/img/gh/rsanheim/backspin/tree/main.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/rsanheim/backspin/tree/main)
1
+ # Backspin
2
+
3
+ [![Ruby](https://img.shields.io/badge/ruby-%23CC342D.svg?style=flat&logo=ruby&logoColor=white)](https://www.ruby-lang.org/)
4
+ [![Gem Version](https://img.shields.io/gem/v/backspin)](https://rubygems.org/gems/backspin)
5
+ [![CircleCI](https://img.shields.io/circleci/build/github/rsanheim/backspin/main)](https://circleci.com/gh/rsanheim/backspin)
6
+ [![Last Commit](https://img.shields.io/github/last-commit/rsanheim/backspin/main)](https://github.com/rsanheim/backspin/commits/main)
2
7
 
3
8
  Backspin records and replays CLI interactions in Ruby for easy snapshot testing of command-line interfaces. Currently supports `Open3.capture3` and `system` and requires `rspec-mocks`. More system calls and test integrations are welcome - send a PR!
4
9
 
@@ -62,7 +67,7 @@ end
62
67
  result = Backspin.run("echo_test", mode: :record) do
63
68
  Open3.capture3("echo hello")
64
69
  end
65
- # This will save the output to `spec/backspin_data/echo_test.yml`.
70
+ # This will save the output to `fixtures/backspin/echo_test.yml`.
66
71
 
67
72
  # Explicit verify mode: Always verify against existing recording
68
73
  result = Backspin.run("echo_test", mode: :verify) do
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'second'"
9
+ stdout: 'filtered output 2
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,18 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'My"
9
+ - API
10
+ - key
11
+ - is
12
+ - "********************'"
13
+ stdout: 'MY API KEY IS ********************
14
+
15
+ '
16
+ stderr: ''
17
+ status: 0
18
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - hello
9
+ stdout: 'hello
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - hello
9
+ stdout: 'hello
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,26 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'episode"
9
+ - 1'
10
+ stdout: 'EPISODE 1
11
+
12
+ '
13
+ stderr: ''
14
+ status: 0
15
+ recorded_at: '2025-05-01T12:00:00Z'
16
+ - command_type: Open3::Capture3
17
+ args:
18
+ - echo
19
+ - "'episode"
20
+ - 2'
21
+ stdout: 'EPISODE 2
22
+
23
+ '
24
+ stderr: ''
25
+ status: 0
26
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - expected
9
+ stdout: 'expected
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,17 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - bash
8
+ - "-c"
9
+ - echo 'stdout message' && echo 'stderr message' >&2 && exit 42
10
+ stdout: 'stdout message
11
+
12
+ '
13
+ stderr: 'stderr message
14
+
15
+ '
16
+ status: 42
17
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,24 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - echo
8
+ - from
9
+ - system
10
+ stdout: ''
11
+ stderr: ''
12
+ status: 0
13
+ recorded_at: '2025-05-01T12:00:00Z'
14
+ - command_type: Open3::Capture3
15
+ args:
16
+ - echo
17
+ - from
18
+ - capture3
19
+ stdout: 'from capture3
20
+
21
+ '
22
+ stderr: ''
23
+ status: 0
24
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,34 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - first
9
+ stdout: 'first
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
15
+ - command_type: Open3::Capture3
16
+ args:
17
+ - echo
18
+ - second
19
+ stdout: 'second
20
+
21
+ '
22
+ stderr: ''
23
+ status: 0
24
+ recorded_at: '2025-05-01T12:00:00Z'
25
+ - command_type: Open3::Capture3
26
+ args:
27
+ - echo
28
+ - third
29
+ stdout: 'third
30
+
31
+ '
32
+ stderr: ''
33
+ status: 0
34
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,26 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'Count:"
9
+ - 42'
10
+ stdout: 'Count: X
11
+
12
+ '
13
+ stderr: ''
14
+ status: 0
15
+ recorded_at: '2025-05-01T12:00:00Z'
16
+ - command_type: Open3::Capture3
17
+ args:
18
+ - echo
19
+ - "'Total:"
20
+ - 100'
21
+ stdout: 'Total: X
22
+
23
+ '
24
+ stderr: ''
25
+ status: 0
26
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,13 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - bash
8
+ - "-c"
9
+ - echo 'out' && echo 'err' >&2 && exit 1
10
+ stdout: modified stdout
11
+ stderr: modified stderr
12
+ status: 0
13
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,20 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - echo
8
+ - first
9
+ stdout: ''
10
+ stderr: ''
11
+ status: 0
12
+ recorded_at: '2025-05-01T12:00:00Z'
13
+ - command_type: Kernel::System
14
+ args:
15
+ - echo
16
+ - second
17
+ stdout: ''
18
+ stderr: ''
19
+ status: 0
20
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'test'"
9
+ stdout: 'test
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'original'"
9
+ stdout: 'original
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,17 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'File"
9
+ - saved
10
+ - to
11
+ - "/Users/testuser/project/output.txt'"
12
+ stdout: 'File saved to PROJECT_ROOT/output.txt
13
+
14
+ '
15
+ stderr: ''
16
+ status: 0
17
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,12 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - echo
8
+ - recorded
9
+ stdout: ''
10
+ stderr: ''
11
+ status: 0
12
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - original
9
+ stdout: 'original
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,19 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - sh
8
+ - "-c"
9
+ - "'echo"
10
+ - error
11
+ - ">&2;"
12
+ - exit
13
+ - 1'
14
+ stdout: ''
15
+ stderr: 'error
16
+
17
+ '
18
+ status: 1
19
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,12 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - echo
8
+ - hello
9
+ stdout: ''
10
+ stderr: ''
11
+ status: 0
12
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,18 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - 'true'
8
+ stdout: ''
9
+ stderr: ''
10
+ status: 0
11
+ recorded_at: '2025-05-01T12:00:00Z'
12
+ - command_type: Kernel::System
13
+ args:
14
+ - 'false'
15
+ stdout: ''
16
+ stderr: ''
17
+ status: 1
18
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,18 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'Test"
9
+ - run
10
+ - at
11
+ - '2024-01-15'
12
+ - 10:30:45'
13
+ stdout: 'Test run at TIMESTAMP
14
+
15
+ '
16
+ stderr: ''
17
+ status: 0
18
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,15 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - echo
8
+ - "'hello"
9
+ - world'
10
+ stdout: 'HELLO WORLD
11
+
12
+ '
13
+ stderr: ''
14
+ status: 0
15
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,12 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - echo
8
+ - hello
9
+ stdout: ''
10
+ stderr: ''
11
+ status: 0
12
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,11 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Kernel::System
6
+ args:
7
+ - 'true'
8
+ stdout: ''
9
+ stderr: ''
10
+ status: 0
11
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -0,0 +1,14 @@
1
+ ---
2
+ first_recorded_at: '2025-05-01T12:00:00Z'
3
+ format_version: '2.0'
4
+ commands:
5
+ - command_type: Open3::Capture3
6
+ args:
7
+ - ruby
8
+ - "--version"
9
+ stdout: 'ruby 3.4.4 (2025-05-14 revision a38531fd3f) +PRISM [arm64-darwin24]
10
+
11
+ '
12
+ stderr: ''
13
+ status: 0
14
+ recorded_at: '2025-05-01T12:00:00Z'
@@ -1,3 +1,3 @@
1
1
  module Backspin
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/backspin.rb CHANGED
@@ -21,7 +21,7 @@ module Backspin
21
21
  # Configuration for Backspin
22
22
  class Configuration
23
23
  attr_accessor :scrub_credentials
24
- # The directory where backspin will store its files - defaults to spec/backspin_data
24
+ # The directory where backspin will store its files - defaults to fixtures/backspin
25
25
  attr_accessor :backspin_dir
26
26
  # Regex patterns to scrub from saved output
27
27
  attr_reader :credential_patterns
@@ -29,7 +29,7 @@ module Backspin
29
29
  def initialize
30
30
  @scrub_credentials = true
31
31
  @credential_patterns = default_credential_patterns
32
- @backspin_dir = Pathname(Dir.pwd).join("spec", "backspin_data")
32
+ @backspin_dir = Pathname(Dir.pwd).join("fixtures", "backspin")
33
33
  end
34
34
 
35
35
  def add_credential_pattern(pattern)
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Sanheim
@@ -62,6 +62,31 @@ files:
62
62
  - bin/rake
63
63
  - bin/rspec
64
64
  - bin/setup
65
+ - fixtures/backspin/all_mode_filter.yml
66
+ - fixtures/backspin/credential_filter.yml
67
+ - fixtures/backspin/echo_hello.yml
68
+ - fixtures/backspin/echo_verify.yml
69
+ - fixtures/backspin/episodes_filter.yml
70
+ - fixtures/backspin/failure_test.yml
71
+ - fixtures/backspin/full_data_filter.yml
72
+ - fixtures/backspin/mixed_calls.yml
73
+ - fixtures/backspin/multi_command.yml
74
+ - fixtures/backspin/multi_command_filter.yml
75
+ - fixtures/backspin/multi_field_filter.yml
76
+ - fixtures/backspin/multi_system.yml
77
+ - fixtures/backspin/nil_filter.yml
78
+ - fixtures/backspin/none_mode_test.yml
79
+ - fixtures/backspin/path_test.yml
80
+ - fixtures/backspin/playback_system.yml
81
+ - fixtures/backspin/playback_test.yml
82
+ - fixtures/backspin/stderr_test.yml
83
+ - fixtures/backspin/system_echo.yml
84
+ - fixtures/backspin/system_false.yml
85
+ - fixtures/backspin/timestamp_test.yml
86
+ - fixtures/backspin/use_record_filter.yml
87
+ - fixtures/backspin/verify_system.yml
88
+ - fixtures/backspin/verify_system_diff.yml
89
+ - fixtures/backspin/version_test.yml
65
90
  - lib/backspin.rb
66
91
  - lib/backspin/command.rb
67
92
  - lib/backspin/command_diff.rb