cmdx-rspec 1.3.0 → 2.0.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -0
  3. data/README.md +279 -156
  4. data/lib/cmdx/rspec/helpers.rb +257 -259
  5. data/lib/cmdx/rspec/matchers/be_complete.rb +20 -0
  6. data/lib/cmdx/rspec/matchers/be_deprecated.rb +14 -52
  7. data/lib/cmdx/rspec/matchers/be_interrupted.rb +20 -0
  8. data/lib/cmdx/rspec/matchers/be_ko.rb +19 -0
  9. data/lib/cmdx/rspec/matchers/be_ok.rb +19 -0
  10. data/lib/cmdx/rspec/matchers/be_successful.rb +8 -20
  11. data/lib/cmdx/rspec/matchers/have_been_retried.rb +41 -0
  12. data/lib/cmdx/rspec/matchers/have_been_rolled_back.rb +23 -0
  13. data/lib/cmdx/rspec/matchers/have_callback.rb +46 -0
  14. data/lib/cmdx/rspec/matchers/have_chain_root.rb +30 -0
  15. data/lib/cmdx/rspec/matchers/have_chain_size.rb +29 -0
  16. data/lib/cmdx/rspec/matchers/have_duration.rb +30 -0
  17. data/lib/cmdx/rspec/matchers/have_empty_context.rb +4 -16
  18. data/lib/cmdx/rspec/matchers/have_empty_metadata.rb +3 -9
  19. data/lib/cmdx/rspec/matchers/have_errors_on.rb +50 -0
  20. data/lib/cmdx/rspec/matchers/have_failed.rb +7 -24
  21. data/lib/cmdx/rspec/matchers/have_input.rb +41 -0
  22. data/lib/cmdx/rspec/matchers/have_matching_context.rb +5 -20
  23. data/lib/cmdx/rspec/matchers/have_matching_metadata.rb +5 -17
  24. data/lib/cmdx/rspec/matchers/have_middleware.rb +29 -0
  25. data/lib/cmdx/rspec/matchers/have_no_errors.rb +30 -0
  26. data/lib/cmdx/rspec/matchers/have_output.rb +46 -0
  27. data/lib/cmdx/rspec/matchers/have_pipeline_tasks.rb +27 -0
  28. data/lib/cmdx/rspec/matchers/have_retry_on.rb +36 -0
  29. data/lib/cmdx/rspec/matchers/have_skipped.rb +7 -24
  30. data/lib/cmdx/rspec/matchers/have_tag.rb +30 -0
  31. data/lib/cmdx/rspec/matchers/raise_cmdx_fault.rb +74 -0
  32. data/lib/cmdx/rspec/version.rb +2 -1
  33. data/lib/cmdx/rspec.rb +22 -3
  34. metadata +24 -15
  35. data/.cursor/prompts/docs.md +0 -12
  36. data/.cursor/prompts/llms.md +0 -20
  37. data/.cursor/prompts/rspec.md +0 -24
  38. data/.cursor/prompts/yardoc.md +0 -14
  39. data/.cursor/rules/cursor-instructions.mdc +0 -62
  40. data/.rspec +0 -4
  41. data/.rubocop.yml +0 -64
  42. data/src/cmdx-dark-logo.png +0 -0
  43. data/src/cmdx-light-logo.png +0 -0
  44. data/src/cmdx-logo.svg +0 -1
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matcher to verify that a {CMDx::Result}, task instance, or {CMDx::Errors}
4
+ # is free of errors.
5
+ #
6
+ # @example
7
+ # expect(result).to have_no_errors
8
+ RSpec::Matchers.define :have_no_errors do
9
+ description { "have no errors" }
10
+
11
+ failure_message do |actual|
12
+ errors = extract_errors(actual)
13
+ "expected #{actual.inspect} to have no errors, but had #{errors&.to_h.inspect}"
14
+ end
15
+
16
+ match do |actual|
17
+ errors = extract_errors(actual)
18
+ next false if errors.nil?
19
+
20
+ errors.empty?
21
+ end
22
+
23
+ define_method(:extract_errors) do |actual|
24
+ case actual
25
+ when CMDx::Errors then actual
26
+ when CMDx::Result, CMDx::Task then actual.errors
27
+ else actual.respond_to?(:errors) ? actual.errors : nil
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matcher to verify that a task class declares an output named +name+.
4
+ # Optional keyword arguments are matched against the output's serialized
5
+ # {CMDx::Output#to_h} (partial match — only provided keys are checked).
6
+ #
7
+ # @example Existence check
8
+ # expect(MyCommand).to have_output(:total)
9
+ #
10
+ # @example Required output
11
+ # expect(MyCommand).to have_output(:total, required: true)
12
+ RSpec::Matchers.define :have_output do |name, **expected|
13
+ description do
14
+ expected.empty? ? "have output #{name.inspect}" : "have output #{name.inspect} matching #{expected.inspect}"
15
+ end
16
+
17
+ failure_message do |actual|
18
+ target = actual.is_a?(Class) ? actual : actual.class
19
+ output = target.outputs.registry[name.to_sym]
20
+ if output.nil?
21
+ "expected #{target} to declare output #{name.inspect}, but registry has #{target.outputs.registry.keys.inspect}"
22
+ else
23
+ "expected #{target}'s output #{name.inspect} to match #{expected.inspect}, but it was #{output.to_h.inspect}"
24
+ end
25
+ end
26
+
27
+ match do |actual|
28
+ target = actual.is_a?(Class) ? actual : actual.class
29
+ next false unless target.respond_to?(:outputs)
30
+
31
+ output = target.outputs.registry[name.to_sym]
32
+ next false if output.nil?
33
+ next true if expected.empty?
34
+
35
+ expected.all? do |k, v|
36
+ actual =
37
+ case k
38
+ when :name then output.name
39
+ when :description then output.description
40
+ else output.to_h.fetch(:options, {})[k]
41
+ end
42
+ actual = false if k == :required && actual.nil?
43
+ values_match?(v, actual)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matcher to verify that a {CMDx::Workflow} class declares the given
4
+ # pipeline tasks. Compares the flattened, deduplicated pipeline against
5
+ # the expected task classes (order-sensitive).
6
+ #
7
+ # @example
8
+ # expect(MyWorkflow).to have_pipeline_tasks(StepA, StepB, StepC)
9
+ #
10
+ # @example Order-insensitive variant
11
+ # expect(MyWorkflow).to have_pipeline_tasks(StepA, StepC, StepB).in_any_order
12
+ RSpec::Matchers.define :have_pipeline_tasks do |*expected|
13
+ description { "have pipeline tasks #{expected.inspect}" }
14
+
15
+ failure_message do |actual|
16
+ "expected #{actual} pipeline to be #{expected.inspect}, but was #{actual.pipeline.flat_map(&:tasks).uniq.inspect}"
17
+ end
18
+
19
+ match do |actual|
20
+ raise ArgumentError, "must be a CMDx::Workflow" unless actual.is_a?(Class) && actual.include?(CMDx::Workflow)
21
+
22
+ tasks = actual.pipeline.flat_map(&:tasks).uniq
23
+ @any_order ? tasks.sort_by(&:object_id) == expected.sort_by(&:object_id) : tasks == expected
24
+ end
25
+
26
+ chain(:in_any_order) { @any_order = true }
27
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matcher to verify that a task class is configured to retry on +exception+.
4
+ # Optional keyword arguments check the {CMDx::Retry} configuration values
5
+ # (`:limit`, `:delay`, `:max_delay`, `:jitter`).
6
+ #
7
+ # @example
8
+ # expect(MyCommand).to have_retry_on(Net::OpenTimeout)
9
+ # expect(MyCommand).to have_retry_on(Net::OpenTimeout, limit: 5, jitter: :exponential)
10
+ RSpec::Matchers.define :have_retry_on do |exception, **expected|
11
+ description do
12
+ expected.empty? ? "have retry on #{exception}" : "have retry on #{exception} matching #{expected.inspect}"
13
+ end
14
+
15
+ failure_message do |actual|
16
+ target = actual.is_a?(Class) ? actual : actual.class
17
+ retry_cfg = target.retry_on
18
+ if retry_cfg.exceptions.none?(exception)
19
+ "expected #{target} to retry on #{exception}, but only retries on #{retry_cfg.exceptions.inspect}"
20
+ else
21
+ mismatched = expected.reject { |k, v| retry_cfg.public_send(k) == v }
22
+ "expected #{target}'s retry_on to match #{expected.inspect}, but mismatched: #{mismatched.inspect}"
23
+ end
24
+ end
25
+
26
+ match do |actual|
27
+ target = actual.is_a?(Class) ? actual : actual.class
28
+ next false unless target.respond_to?(:retry_on)
29
+
30
+ retry_cfg = target.retry_on
31
+ next false unless retry_cfg.exceptions.include?(exception)
32
+ next true if expected.empty?
33
+
34
+ expected.all? { |k, v| retry_cfg.public_send(k) == v }
35
+ end
36
+ end
@@ -1,25 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Matcher to verify that a result represents a skipped execution.
3
+ # Asserts a {CMDx::Result} was skipped (`state: interrupted`,
4
+ # `status: skipped`). Extra keyword args constrain other `result.to_h`
5
+ # fields such as `:reason`, `:cause`, or `:metadata`.
4
6
  #
5
- # @param data [Hash] Optional hash of additional attributes to match
6
- # @option data [Symbol] :state Expected state (defaults to CMDx::Result::INTERRUPTED)
7
- # @option data [Symbol] :status Expected status (defaults to CMDx::Result::SKIPPED)
8
- # @option data [Symbol] :outcome Expected outcome (defaults to CMDx::Result::SKIPPED)
9
- # @option data [String] :reason Expected reason string
10
- # @option data [CMDx::SkipFault] :cause Expected cause fault
11
- #
12
- # @return [RSpec::Matchers::BuiltIn::BaseMatcher] The matcher instance
13
- #
14
- # @raise [ArgumentError] if the actual value is not a CMDx::Result
15
- #
16
- # @example Checking if a result is skipped
17
- # result = MyCommand.execute
18
- # expect(result).to have_skipped
19
- #
20
- # @example Checking skipped with specific reason
21
- # result = MyCommand.execute
22
- # expect(result).to have_skipped(reason: "Skipped for testing")
7
+ # @example
8
+ # expect(result).to have_skipped(reason: "out of stock")
23
9
  RSpec::Matchers.define :have_skipped do |**data|
24
10
  description { "have been skipped" }
25
11
 
@@ -27,11 +13,8 @@ RSpec::Matchers.define :have_skipped do |**data|
27
13
  raise ArgumentError, "must be a CMDx::Result" unless result.is_a?(CMDx::Result)
28
14
 
29
15
  expect(result.to_h).to include(
30
- state: CMDx::Result::INTERRUPTED,
31
- status: CMDx::Result::SKIPPED,
32
- outcome: CMDx::Result::SKIPPED,
33
- reason: CMDx::Locale.t("cmdx.faults.unspecified"),
34
- cause: be_a(CMDx::SkipFault),
16
+ state: CMDx::Signal::INTERRUPTED,
17
+ status: CMDx::Signal::SKIPPED,
35
18
  **data
36
19
  )
37
20
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matcher to verify that a {CMDx::Result} (or task class) carries +tag+
4
+ # in its settings tags.
5
+ #
6
+ # @example
7
+ # expect(result).to have_tag(:critical)
8
+ # expect(MyCommand).to have_tag(:critical)
9
+ RSpec::Matchers.define :have_tag do |tag|
10
+ description { "have tag #{tag.inspect}" }
11
+
12
+ failure_message do |actual|
13
+ tags = extract_tags(actual)
14
+ "expected #{actual} to have tag #{tag.inspect}, but had #{tags.inspect}"
15
+ end
16
+
17
+ match do |actual|
18
+ extract_tags(actual).include?(tag)
19
+ end
20
+
21
+ define_method(:extract_tags) do |actual|
22
+ case actual
23
+ when CMDx::Result then actual.tags
24
+ when Class
25
+ actual.respond_to?(:settings) ? actual.settings.tags : []
26
+ else
27
+ actual.respond_to?(:tags) ? actual.tags : []
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matcher to verify that a block raises a {CMDx::Fault}, optionally
4
+ # constraining which task originated the failure, the failure reason, and
5
+ # the underlying cause.
6
+ #
7
+ # @example Any CMDx fault
8
+ # expect { MyCommand.execute! }.to raise_cmdx_fault
9
+ #
10
+ # @example From a specific task class (matches `fault.task`, the leaf failure)
11
+ # expect { MyCommand.execute! }.to raise_cmdx_fault(MyCommand)
12
+ #
13
+ # @example With a specific reason
14
+ # expect { MyCommand.execute! }.to raise_cmdx_fault.with_reason("invalid")
15
+ #
16
+ # @example With a regex reason and a specific underlying cause
17
+ # expect { MyCommand.execute! }
18
+ # .to raise_cmdx_fault(MyCommand).with_reason(/invalid/).with_cause(MyError)
19
+ RSpec::Matchers.define :raise_cmdx_fault do |expected_task = nil|
20
+ description do
21
+ parts = ["raise CMDx::Fault"]
22
+ parts << "from #{expected_task}" if expected_task
23
+ parts << "with reason #{@expected_reason.inspect}" if defined?(@expected_reason)
24
+ parts << "with cause #{@expected_cause.inspect}" if defined?(@expected_cause)
25
+ parts.join(" ")
26
+ end
27
+
28
+ supports_block_expectations
29
+
30
+ match do |block|
31
+ raise ArgumentError, "block required" unless block.respond_to?(:call)
32
+
33
+ @actual_fault = nil
34
+ begin
35
+ block.call
36
+ rescue CMDx::Fault => e
37
+ @actual_fault = e
38
+ end
39
+
40
+ next false if @actual_fault.nil?
41
+ next false if expected_task && !(@actual_fault.task <= expected_task) # rubocop:disable Style/InverseMethods
42
+ next false if defined?(@expected_reason) && !reason_matches?(@actual_fault.result.reason)
43
+ next false if defined?(@expected_cause) && !cause_matches?(@actual_fault.result.cause)
44
+
45
+ true
46
+ end
47
+
48
+ failure_message do
49
+ if @actual_fault.nil?
50
+ "expected block to raise CMDx::Fault, but nothing was raised"
51
+ else
52
+ "expected #{@actual_fault.inspect} (task: #{@actual_fault.task}, reason: " \
53
+ "#{@actual_fault.result.reason.inspect}, cause: #{@actual_fault.result.cause.inspect}) " \
54
+ "to satisfy the matcher"
55
+ end
56
+ end
57
+
58
+ chain(:with_reason) { |reason| @expected_reason = reason }
59
+ chain(:with_cause) { |cause| @expected_cause = cause }
60
+
61
+ define_method(:reason_matches?) do |actual|
62
+ case @expected_reason
63
+ when Regexp then @expected_reason.match?(actual.to_s)
64
+ else @expected_reason == actual
65
+ end
66
+ end
67
+
68
+ define_method(:cause_matches?) do |actual|
69
+ case @expected_cause
70
+ when Class then actual.is_a?(@expected_cause)
71
+ else values_match?(@expected_cause, actual)
72
+ end
73
+ end
74
+ end
@@ -3,7 +3,8 @@
3
3
  module CMDx
4
4
  module RSpec
5
5
 
6
- VERSION = "1.3.0"
6
+ # Gem version. Bumped on release; mirrored in the gemspec.
7
+ VERSION = "2.0.0"
7
8
 
8
9
  end
9
10
  end
data/lib/cmdx/rspec.rb CHANGED
@@ -5,11 +5,30 @@ require "rspec"
5
5
 
6
6
  require_relative "rspec/helpers"
7
7
 
8
+ require_relative "rspec/matchers/be_complete"
8
9
  require_relative "rspec/matchers/be_deprecated"
10
+ require_relative "rspec/matchers/be_interrupted"
11
+ require_relative "rspec/matchers/be_ko"
12
+ require_relative "rspec/matchers/be_ok"
9
13
  require_relative "rspec/matchers/be_successful"
10
- require_relative "rspec/matchers/have_skipped"
11
- require_relative "rspec/matchers/have_failed"
14
+ require_relative "rspec/matchers/have_been_retried"
15
+ require_relative "rspec/matchers/have_been_rolled_back"
16
+ require_relative "rspec/matchers/have_callback"
17
+ require_relative "rspec/matchers/have_chain_root"
18
+ require_relative "rspec/matchers/have_chain_size"
19
+ require_relative "rspec/matchers/have_duration"
12
20
  require_relative "rspec/matchers/have_empty_context"
13
- require_relative "rspec/matchers/have_matching_context"
14
21
  require_relative "rspec/matchers/have_empty_metadata"
22
+ require_relative "rspec/matchers/have_errors_on"
23
+ require_relative "rspec/matchers/have_failed"
24
+ require_relative "rspec/matchers/have_input"
25
+ require_relative "rspec/matchers/have_matching_context"
15
26
  require_relative "rspec/matchers/have_matching_metadata"
27
+ require_relative "rspec/matchers/have_middleware"
28
+ require_relative "rspec/matchers/have_no_errors"
29
+ require_relative "rspec/matchers/have_output"
30
+ require_relative "rspec/matchers/have_pipeline_tasks"
31
+ require_relative "rspec/matchers/have_retry_on"
32
+ require_relative "rspec/matchers/have_skipped"
33
+ require_relative "rspec/matchers/have_tag"
34
+ require_relative "rspec/matchers/raise_cmdx_fault"
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: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: 1.5.0
18
+ version: 2.0.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: 1.5.0
25
+ version: 2.0.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -142,18 +135,34 @@ files:
142
135
  - Rakefile
143
136
  - lib/cmdx/rspec.rb
144
137
  - lib/cmdx/rspec/helpers.rb
138
+ - lib/cmdx/rspec/matchers/be_complete.rb
145
139
  - lib/cmdx/rspec/matchers/be_deprecated.rb
140
+ - lib/cmdx/rspec/matchers/be_interrupted.rb
141
+ - lib/cmdx/rspec/matchers/be_ko.rb
142
+ - lib/cmdx/rspec/matchers/be_ok.rb
146
143
  - lib/cmdx/rspec/matchers/be_successful.rb
144
+ - lib/cmdx/rspec/matchers/have_been_retried.rb
145
+ - lib/cmdx/rspec/matchers/have_been_rolled_back.rb
146
+ - lib/cmdx/rspec/matchers/have_callback.rb
147
+ - lib/cmdx/rspec/matchers/have_chain_root.rb
148
+ - lib/cmdx/rspec/matchers/have_chain_size.rb
149
+ - lib/cmdx/rspec/matchers/have_duration.rb
147
150
  - lib/cmdx/rspec/matchers/have_empty_context.rb
148
151
  - lib/cmdx/rspec/matchers/have_empty_metadata.rb
152
+ - lib/cmdx/rspec/matchers/have_errors_on.rb
149
153
  - lib/cmdx/rspec/matchers/have_failed.rb
154
+ - lib/cmdx/rspec/matchers/have_input.rb
150
155
  - lib/cmdx/rspec/matchers/have_matching_context.rb
151
156
  - lib/cmdx/rspec/matchers/have_matching_metadata.rb
157
+ - lib/cmdx/rspec/matchers/have_middleware.rb
158
+ - lib/cmdx/rspec/matchers/have_no_errors.rb
159
+ - lib/cmdx/rspec/matchers/have_output.rb
160
+ - lib/cmdx/rspec/matchers/have_pipeline_tasks.rb
161
+ - lib/cmdx/rspec/matchers/have_retry_on.rb
152
162
  - lib/cmdx/rspec/matchers/have_skipped.rb
163
+ - lib/cmdx/rspec/matchers/have_tag.rb
164
+ - lib/cmdx/rspec/matchers/raise_cmdx_fault.rb
153
165
  - lib/cmdx/rspec/version.rb
154
- - src/cmdx-dark-logo.png
155
- - src/cmdx-light-logo.png
156
- - src/cmdx-logo.svg
157
166
  homepage: https://github.com/drexed/cmdx-rspec
158
167
  licenses:
159
168
  - MIT
@@ -171,14 +180,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
180
  requirements:
172
181
  - - ">="
173
182
  - !ruby/object:Gem::Version
174
- version: 3.1.0
183
+ version: 3.3.0
175
184
  required_rubygems_version: !ruby/object:Gem::Requirement
176
185
  requirements:
177
186
  - - ">="
178
187
  - !ruby/object:Gem::Version
179
188
  version: '0'
180
189
  requirements: []
181
- rubygems_version: 3.7.2
190
+ rubygems_version: 4.0.11
182
191
  specification_version: 4
183
192
  summary: Simple CMDx task testing via RSpec matchers.
184
193
  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>