cmdx-rspec 1.3.0 → 1.4.0

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: 4fc7ba1c5a520fd78933d838b99697a1aeb3e13aab9383f430ca22b3c227b6de
4
- data.tar.gz: 4feb370c926b26b7499e51cf547bca870edc0ebff1184c4431b9fbf107258493
3
+ metadata.gz: 0616efb98c57af6ccff186eac481bf366c42feb22c3c9da20e9060c79a261ab5
4
+ data.tar.gz: abaf7805901a616df62e2d3825862f221981d4e9a7424ee442ddd18203e7074d
5
5
  SHA512:
6
- metadata.gz: 4656c4a7f6cd3a4d4c111edcc6d8cee2fe26049f9925d195734a13e8e9bf63c3dd03cbe60a3805e6bcb47c8e4fa327e60f24cd2f7970d07cc225cec702172127
7
- data.tar.gz: 6f0ceb3dca15652a1dbdff3ee6f06cf0530b7562365fa98ac698f4618310ab5bff2f6c0a2ce83b88b8ed443115dbfc7f8194eb7fb7498316ce27317041c0040d
6
+ metadata.gz: 986ae1097c9f5b084f8ec3b65b9c803f3443bc77fbd21299712d8fceb1983c05e61ea7ca7619053e48fd8d6057002259fb315c1a8b16457de79d6bfd874c6c84
7
+ data.tar.gz: 00e76f0d58ce7b4334adccc0e39dec3b83f22b4399ffe42511f747bbc0ab87eedbb3edf0357a7e5a0438d727103b2563ea92253d92696c36d66f0c04ec866c9b
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.4.0] - 2026-04-09
10
+
11
+ ### Added
12
+ - Added `stub_workflow_tasks` helper
13
+
9
14
  ## [1.3.0] - 2025-11-09
10
15
 
11
16
  ### Added
data/README.md CHANGED
@@ -221,6 +221,28 @@ it "stubs task with a custom cause" do
221
221
  end
222
222
  ```
223
223
 
224
+ #### Workflows
225
+
226
+ Yields each distinct task class from the workflow’s pipeline (first-seen order) so you can stub them in one place.
227
+
228
+ ```ruby
229
+ it "stubs every pipeline task for a workflow" do
230
+ stub_workflow_tasks(MyWorkflow) do |t|
231
+ if t == TaskB
232
+ stub_task_success(t)
233
+ elsif t == TaskC
234
+ stub_task_skip(t)
235
+ else
236
+ stub_task_success(t)
237
+ end
238
+ end
239
+
240
+ MyWorkflow.execute
241
+
242
+ # Your specs...
243
+ end
244
+ ```
245
+
224
246
  #### Reset
225
247
 
226
248
  ```ruby
@@ -349,6 +349,36 @@ module CMDx
349
349
  end
350
350
  end
351
351
 
352
+ # Yields each unique pipeline task class so workflow specs can stub tasks in one place.
353
+ #
354
+ # @param command [Class] Class including {CMDx::Workflow}
355
+ # @yield [Class] Distinct task class per pipeline stage (first-seen order)
356
+ # @return [Array<Class>] Deduplicated task list ({#each} return value)
357
+ # @raise [ArgumentError] if no block is given
358
+ # @raise [ArgumentError] if +command+ does not include {CMDx::Workflow}
359
+ #
360
+ # @example
361
+ # stub_workflow_tasks(MyWorkflow) do |t|
362
+ # if t == TaskB
363
+ # stub_task_success(t)
364
+ # elsif t == TaskC
365
+ # stub_task_skip(t)
366
+ # else
367
+ # stub_task_success(t)
368
+ # end
369
+ # end
370
+ #
371
+ # MyWorkflow.execute
372
+ def stub_workflow_tasks(command, &)
373
+ if !block_given?
374
+ raise ArgumentError, "block required"
375
+ elsif !command.include?(Workflow)
376
+ raise ArgumentError, "#{command.inspect} must be a workflow"
377
+ end
378
+
379
+ command.pipeline.flat_map(&:tasks).uniq.each(&)
380
+ end
381
+
352
382
  end
353
383
  end
354
384
  end
@@ -58,7 +58,7 @@ RSpec::Matchers.define :be_deprecated do |expected_behavior = nil|
58
58
  target = actual.is_a?(Class) ? actual : actual.class
59
59
 
60
60
  # Check if deprecate setting exists and is truthy
61
- deprecate_setting = target.settings[:deprecate]
61
+ deprecate_setting = target.settings.deprecate
62
62
  return false unless deprecate_setting
63
63
 
64
64
  # If no specific behavior expected, just check if deprecated
@@ -3,7 +3,7 @@
3
3
  module CMDx
4
4
  module RSpec
5
5
 
6
- VERSION = "1.3.0"
6
+ VERSION = "1.4.0"
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmdx-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
@@ -128,13 +128,6 @@ executables: []
128
128
  extensions: []
129
129
  extra_rdoc_files: []
130
130
  files:
131
- - ".cursor/prompts/docs.md"
132
- - ".cursor/prompts/llms.md"
133
- - ".cursor/prompts/rspec.md"
134
- - ".cursor/prompts/yardoc.md"
135
- - ".cursor/rules/cursor-instructions.mdc"
136
- - ".rspec"
137
- - ".rubocop.yml"
138
131
  - CHANGELOG.md
139
132
  - CODE_OF_CONDUCT.md
140
133
  - LICENSE.txt
@@ -151,9 +144,6 @@ files:
151
144
  - lib/cmdx/rspec/matchers/have_matching_metadata.rb
152
145
  - lib/cmdx/rspec/matchers/have_skipped.rb
153
146
  - lib/cmdx/rspec/version.rb
154
- - src/cmdx-dark-logo.png
155
- - src/cmdx-light-logo.png
156
- - src/cmdx-logo.svg
157
147
  homepage: https://github.com/drexed/cmdx-rspec
158
148
  licenses:
159
149
  - MIT
@@ -178,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
168
  - !ruby/object:Gem::Version
179
169
  version: '0'
180
170
  requirements: []
181
- rubygems_version: 3.7.2
171
+ rubygems_version: 4.0.9
182
172
  specification_version: 4
183
173
  summary: Simple CMDx task testing via RSpec matchers.
184
174
  test_files: []
@@ -1,12 +0,0 @@
1
- You are a senior Ruby developer with expert knowledge of CMDx and writing documentation.
2
-
3
- Update the active tab using the following guidelines:
4
-
5
- - Follow best practices and implementation
6
- - Use a consistent professional voice
7
- - Examples should be concise, non-repetitive, and realistic
8
- - Update any pre-existing documentation to match stated rules
9
- - Examples should not cross boundaries or focus
10
- - Docs must cover both typical use cases, including invalid inputs and error conditions
11
- - Use GitHub flavored markdown, including alerts to emphasize critical information (https://github.com/orgs/community/discussions/16925)
12
- - Optimize for LLM's including coding and AI agents
@@ -1,20 +0,0 @@
1
- Process the following instructions in the order given:
2
-
3
- 1. Create an `LLM.md` file
4
- 2. Append all files within `docs/**/*.md` into @LLM.md
5
- 2a. Use order outlined in the table of contents of @README.md
6
- 2b. Process one file at a time faster performance and improved accuracy
7
- 2c. Remove the table of contents from the chunk
8
- 2c. Remove the navigations below `---` from the chunk
9
- 2d. Wrap the chunk the files GitHub url the top and a spacer at the bottom like so:
10
- ```
11
-
12
- ---
13
- url: https://github.com/drexed/cmdx/blob/main/docs/callbacks.md
14
- ---
15
-
16
- {{ chunk }}
17
-
18
- ---
19
-
20
- ```
@@ -1,24 +0,0 @@
1
- You are a senior Ruby developer with expert knowledge of RSpec.
2
-
3
- Add tests for the active tab using the following guidelines:
4
-
5
- - Expectations should be concise, non-repetitive, and realistic (how it would be used in the real world)
6
- - Follow best practices and implementation
7
- - Update any pre-existing specs to match stated rules
8
- - New tests should be consistent with current `spec/cmdx` specs
9
- - Use custom matchers available within `lib/cmdx/rspec`
10
- - Use task helpers available within `spec/support/helpers`
11
- - Use stubs to return predefined values for specific methods. Isolate the unit being tested, but avoid over-mocking; test real behavior when possible (mocks should be used only when necessary)
12
- - Ensure each test is independent; avoid shared state between tests
13
- - Use let and let! to define test data, ensuring minimal and necessary setup
14
- - Context block descriptions should start with the following words: `when`, `with`, `without`
15
- - Organize tests logically using describe for classes/modules and context for different scenarios
16
- - Use subject to define the object under test when appropriate to avoid repetition
17
- - Ensure test file paths mirror the structure of the files being tested, but within the spec directory (e.g., lib/cmdx/task.rb → spec/cmdx/task_spec.rb)
18
- - Use clear and descriptive names for describe, context, and it blocks
19
- - Prefer the expect syntax for assertions to improve readability
20
- - Keep test code concise; avoid unnecessary complexity or duplication
21
- - Tests must cover both typical cases and edge cases, including invalid inputs and error conditions
22
- - Consider all possible scenarios for each method or behavior and ensure they are tested
23
- - Do NOT include integration or real world examples
24
- - Verify all specs are passing
@@ -1,14 +0,0 @@
1
- You are a senior Ruby developer with expert knowledge of YARDoc.
2
-
3
- Add yardoc to the active tab using the following guidelines:
4
-
5
- - Follow best practices and implementation
6
- - New documentation should be consistent with current `lib/cmdx` documentation
7
- - Examples should be concise, non-repetitive, and realistic
8
- - Avoid unnecessary complexity or duplication
9
- - Update any pre-existing documentation to match stated rules
10
- - Do NOT include `CMDx` module level docs
11
- - Module level docs description should NOT include `@example`
12
- - Method level docs should include `@example`, `param`, `@options`, `@return`, and any `@raise`
13
- - Hash `@params` should expand with possible `@option`
14
- - Module and method level docs should NOT include `@since`
@@ -1,62 +0,0 @@
1
- ---
2
- description:
3
- globs:
4
- alwaysApply: true
5
- ---
6
-
7
- # Ruby Coding Standards
8
-
9
- Follow the official Ruby gem guides for best practices.
10
- Reference the guides outlined in https://guides.rubygems.org
11
-
12
- ## Project Context
13
- CMDx::RSpec is a collection of RSpec matchers for the CMDx framework.
14
- Reference the CMDx documentation in https://drexed.github.io/cmdx/llms.txt
15
- Reference the CMDx::RSpec documentation in https://github.com/drexed/cmdx-rspec/blob/main/README.md
16
-
17
- ## Technology Stack
18
- - Ruby 3.4+
19
- - RSpec 3.1+
20
- - CMDx 1.5+
21
-
22
- ## Code Style and Structure
23
- - Write concise, idiomatic Ruby code with accurate examples
24
- - Follow Ruby conventions and best practices
25
- - Use object-oriented and functional programming patterns as appropriate
26
- - Prefer iteration and modularization over code duplication
27
- - Use descriptive variable and method names (e.g., user_signed_in?, calculate_total)
28
- - Write comprehensive code documentation using the Yardoc format
29
-
30
- ## Naming Conventions
31
- - Use snake_case for file names, method names, and variables
32
- - Use CamelCase for class and module names
33
-
34
- ## Syntax and Formatting
35
- - Follow the Ruby Style Guide (https://rubystyle.guide/)
36
- - Follow Ruby style conventions (2-space indentation, snake_case methods)
37
- - Use Ruby's expressive syntax (e.g., unless, ||=, &.)
38
- - Prefer double quotes for strings
39
- - Respect my Rubocop options
40
-
41
- ## Performance Optimization
42
- - Use memoization for expensive operations
43
-
44
- ## Testing
45
- - Follow the RSpec Style Guide (https://rspec.rubystyle.guide/)
46
- - Write comprehensive tests using RSpec
47
- - It's ok to put multiple assertions in the same example
48
- - Include both BDD and TDD based tests
49
- - Create test objects to share across tests
50
- - Do NOT make tests for obvious or reflective expectations
51
- - Prefer real objects over mocks. Use `instance_double` if necessary; never `double`
52
- - Don't test declarative configuration
53
- - Use appropriate matchers
54
- - Update tests and update Yardocs after you write code
55
-
56
- ## Documentation
57
- - Utilize the YARDoc format when documenting Ruby code
58
- - Follow these best practices:
59
- - Avoid redundant comments that merely restate the code
60
- - Keep comments up-to-date with code changes
61
- - Keep documentation consistent
62
- - Update CHANGELOG.md with any changes
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --backtrace
2
- --color
3
- --format progress
4
- --order random
data/.rubocop.yml DELETED
@@ -1,64 +0,0 @@
1
- plugins:
2
- - rubocop-performance
3
- - rubocop-rake
4
- - rubocop-rspec
5
- AllCops:
6
- NewCops: enable
7
- DisplayCopNames: true
8
- DisplayStyleGuide: true
9
- TargetRubyVersion: 3.1
10
- Gemspec/DevelopmentDependencies:
11
- EnforcedStyle: gemspec
12
- Layout/EmptyLinesAroundAttributeAccessor:
13
- Enabled: true
14
- Layout/EmptyLinesAroundClassBody:
15
- EnforcedStyle: empty_lines_except_namespace
16
- Layout/EmptyLinesAroundModuleBody:
17
- EnforcedStyle: empty_lines_except_namespace
18
- Layout/FirstHashElementIndentation:
19
- EnforcedStyle: consistent
20
- Layout/LineLength:
21
- Enabled: false
22
- Metrics/AbcSize:
23
- Enabled: false
24
- Metrics/BlockLength:
25
- Enabled: false
26
- Metrics/CyclomaticComplexity:
27
- Enabled: false
28
- Metrics/MethodLength:
29
- Enabled: false
30
- Metrics/PerceivedComplexity:
31
- Enabled: false
32
- RSpec/DescribeClass:
33
- Enabled: false
34
- RSpec/ExampleLength:
35
- Enabled: false
36
- RSpec/IndexedLet:
37
- Enabled: false
38
- RSpec/MessageSpies:
39
- EnforcedStyle: receive
40
- RSpec/MultipleExpectations:
41
- Enabled: false
42
- RSpec/MultipleMemoizedHelpers:
43
- Enabled: false
44
- RSpec/NestedGroups:
45
- Enabled: false
46
- RSpec/SpecFilePathFormat:
47
- CustomTransform:
48
- CMDx: cmdx
49
- RSpec/SubjectStub:
50
- Enabled: false
51
- RSpec/StubbedMock:
52
- Enabled: false
53
- RSpec/VerifiedDoubleReference:
54
- Enabled: false
55
- Style/Documentation:
56
- Enabled: false
57
- Style/FrozenStringLiteralComment:
58
- Enabled: true
59
- EnforcedStyle: always_true
60
- SafeAutoCorrect: true
61
- Style/ModuleFunction:
62
- EnforcedStyle: extend_self
63
- Style/StringLiterals:
64
- EnforcedStyle: double_quotes
Binary file
Binary file
data/src/cmdx-logo.svg DELETED
@@ -1 +0,0 @@
1
- <svg width="352.2" height="112.266" viewBox="0 0 203 64.708" xmlns="http://www.w3.org/2000/svg" xmlSpace="preserve"><path d="M172.908 17.723 169.4 23.17 156.385 3.323h3.507l9.508 14.77 1.938-3.139L161.738 0h-11.446L169.4 29.262 188.046 0h-3.97L173 17.54zm-20.677 43.57h-3.139l18.646-29.447L147.431.093h-3.97l20.308 31.846L143 64.708l10.985-.092 39.138-61.2h3.323L174.57 37.754l13.662 21.415h3.969l-13.754-21.415L202.538.093H191.37zm29.63-23.262 15.047 23.262h-10.523l-13.662-20.77-15.508 24.093h3.97l11.63-18 11.723 18H203l-18.83-29.262-.278-.461z" fill="#fe1817"/><path d="M41.667 14v12.8h-23.42c-3.214.272-5.665 3.05-5.665 6.318s2.45 5.937 5.664 6.318H33.17v4.248H18.246a10.65 10.65 0 0 1-9.858-10.62c0-5.447 4.194-10.077 9.64-10.512h19.39v-4.303H18.246v.054A14.823 14.823 0 0 0 4.248 33.118c0 7.898 6.21 14.38 13.998 14.815h19.172v-8.497h4.249v12.745h-23.42A19.063 19.063 0 0 1 0 33.118a19.033 19.033 0 0 1 18.246-19.063zM75 35.623 87.2 14h13.508v38.181H87.963v-14.27l-8.116 14.27h-9.749L57.734 30.504v-8.007l14.87 25.436h4.792l14.815-25.436v25.436h4.249V18.249H89.65l-14.76 25.49-14.542-25.49H53.54v29.684h4.194v-8.007l4.249 7.299v4.956H49.292v-38.18H62.8zM108.333 14h23.42C141.94 14.436 150 22.824 150 33.064c0 10.294-8.061 18.681-18.246 19.117h-23.42V22.497h23.42a10.65 10.65 0 0 1 9.858 10.621c0 5.447-4.194 10.13-9.64 10.566H116.83V30.286h4.248v9.15l10.676-.054c3.213-.273 5.664-3.05 5.664-6.264 0-2.778-1.743-5.065-4.194-5.991-.926-.382-1.47-.382-2.94-.382h-17.702v21.188h19.172a14.84 14.84 0 0 0 13.998-14.87c0-7.897-6.21-14.379-13.998-14.814h-23.42z"/></svg>