cmdx-rspec 0.1.0 → 0.2.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: c71665a9df22d3f4b31837985f80f468cbc8ca745878f596435d86fa78fc6c09
4
- data.tar.gz: 0e89b8a0d57347c00c0b4ebff093945ea9286623f843603c838768b83fcc71d4
3
+ metadata.gz: e5b50ce1284ba0cbca3e8b27f7d69c1eef31d4e11615e30f0d3e2952c640a725
4
+ data.tar.gz: 1a22773141cdc0a4ce6e1715b35215dd4c36f44c62b7a79ca79d70d803a55904
5
5
  SHA512:
6
- metadata.gz: f8128839bb2cfddf0fb79947354869512e355259391abb337e5bec462feeb29cc81b6831509d115b7534d6d7b24c9d85cb1b23c6ea26b0b324e3540344260d93
7
- data.tar.gz: 2e4cd45210779381653e3bfbee2c0cf2d5d7da3521169ca75abf43a47be132b9cd02e9b15844e607046718d6972f26b019615bca6505c1fd6987f3c430bbb288
6
+ metadata.gz: 1362711e07183750d989d874e9bf5d5048b0130f213bc6acccb99af45021c5ec814dea6439f6639ec14f0730e0664ede073ee5b5b4861d89bfa512274af1c7c6
7
+ data.tar.gz: 2fa8252b7217e3e9ae4acf0542b430aafc2ba7623f4839a3d6d544afa5da7e4f5ffdf95931fc3d15cb6216512f4d46f535668219342231e2cf4e1d98ca8268db
@@ -12,7 +12,7 @@ Reference the guides outlined in https://guides.rubygems.org
12
12
  ## Project Context
13
13
  CMDx::RSpec is a collection of RSpec matchers for the CMDx framework.
14
14
  Reference the CMDx documentation in https://github.com/drexed/cmdx/blob/main/LLM.md
15
- Reference the CMDx::I18n documentation in https://github.com/drexed/cmdx-i18n/blob/main/README.md
15
+ Reference the CMDx::RSpec documentation in https://github.com/drexed/cmdx-rspec/blob/main/README.md
16
16
 
17
17
  ## Technology Stack
18
18
  - Ruby 3.4+
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2025-09-13
4
+
5
+ ### Added
6
+ - Added `have_empty_metadata` and `have_matching_metadata` matchers
7
+
8
+ ### Changed
9
+ - Metadata matching must be done via the methods above instead of the fault matchers
10
+
3
11
  ## [0.1.0] - 2025-08-24
4
12
 
5
13
  - Initial release
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="./src/cmdx-rspec-logo.png" width="200" alt="CMDx::I18n Logo">
2
+ <img src="./src/cmdx-rspec-logo.png" width="200" alt="CMDx::RSpec Logo">
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -8,7 +8,7 @@
8
8
  <img alt="License" src="https://img.shields.io/github/license/drexed/cmdx-rspec">
9
9
  </p>
10
10
 
11
- # CMDx::I18n
11
+ # CMDx::RSpec
12
12
 
13
13
  Collection of RSpec matchers for [CMDx](https://github.com/drexed/cmdx).
14
14
 
@@ -66,6 +66,30 @@ it "returns failure" do
66
66
  end
67
67
  ```
68
68
 
69
+ ### have_empty_metadata
70
+
71
+ Asserts that a CMDx task result has no metadata.
72
+
73
+ ```ruby
74
+ it "returns empty metadata" do
75
+ result = SomeTask.execute
76
+
77
+ expect(result).to have_empty_metadata
78
+ end
79
+ ```
80
+
81
+ ### have_matching_metadata
82
+
83
+ Asserts that a CMDx task result contains specific metadata.
84
+
85
+ ```ruby
86
+ it "returns matching metadata" do
87
+ result = SomeTask.execute
88
+
89
+ expect(result).to have_matching_metadata(status_code: 500)
90
+ end
91
+ ```
92
+
69
93
  ### have_empty_context
70
94
 
71
95
  Asserts that a CMDx task result has no context data.
@@ -10,7 +10,6 @@ RSpec::Matchers.define :have_been_failure do |**data|
10
10
  state: CMDx::Result::INTERRUPTED,
11
11
  status: CMDx::Result::FAILED,
12
12
  outcome: CMDx::Result::FAILED,
13
- metadata: {},
14
13
  reason: CMDx::Locale.t("cmdx.faults.unspecified"),
15
14
  cause: be_a(CMDx::FailFault),
16
15
  **data
@@ -10,7 +10,6 @@ RSpec::Matchers.define :have_been_skipped do |**data|
10
10
  state: CMDx::Result::INTERRUPTED,
11
11
  status: CMDx::Result::SKIPPED,
12
12
  outcome: CMDx::Result::SKIPPED,
13
- metadata: {},
14
13
  reason: CMDx::Locale.t("cmdx.faults.unspecified"),
15
14
  cause: be_a(CMDx::SkipFault),
16
15
  **data
@@ -10,7 +10,6 @@ RSpec::Matchers.define :have_been_success do |**data|
10
10
  state: CMDx::Result::COMPLETE,
11
11
  status: CMDx::Result::SUCCESS,
12
12
  outcome: CMDx::Result::SUCCESS,
13
- metadata: {},
14
13
  **data
15
14
  )
16
15
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec::Matchers.define :have_empty_metadata do
4
+ description { "have an empty metadata" }
5
+
6
+ match(notify_expectation_failures: true) do |result|
7
+ raise ArgumentError, "must be a CMDx::Result" unless result.is_a?(CMDx::Result)
8
+
9
+ expect(result.to_h[:metadata]).to be_empty
10
+ end
11
+ end
@@ -12,6 +12,10 @@ RSpec::Matchers.define :have_matching_context do |**data|
12
12
  else raise "unknown context type #{context.class}"
13
13
  end
14
14
 
15
- expect(ctx).to include(**data)
15
+ if data.empty?
16
+ expect(ctx).to have_empty_context
17
+ else
18
+ expect(ctx).to include(**data)
19
+ end
16
20
  end
17
21
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec::Matchers.define :have_matching_metadata do |**data|
4
+ description { "have matching metadata" }
5
+
6
+ match(notify_expectation_failures: true) do |result|
7
+ raise ArgumentError, "must be a CMDx::Result" unless result.is_a?(CMDx::Result)
8
+
9
+ if data.empty?
10
+ expect(result).to have_empty_metadata
11
+ else
12
+ expect(result.to_h[:metadata]).to include(**data)
13
+ end
14
+ end
15
+ end
@@ -3,7 +3,7 @@
3
3
  module CMDx
4
4
  module RSpec
5
5
 
6
- VERSION = "0.1.0"
6
+ VERSION = "0.2.0"
7
7
 
8
8
  end
9
9
  end
data/lib/cmdx/rspec.rb CHANGED
@@ -9,3 +9,5 @@ require_relative "rspec/have_been_skipped"
9
9
  require_relative "rspec/have_been_success"
10
10
  require_relative "rspec/have_empty_context"
11
11
  require_relative "rspec/have_matching_context"
12
+ require_relative "rspec/have_empty_metadata"
13
+ require_relative "rspec/have_matching_metadata"
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: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
@@ -146,7 +146,9 @@ files:
146
146
  - lib/cmdx/rspec/have_been_skipped.rb
147
147
  - lib/cmdx/rspec/have_been_success.rb
148
148
  - lib/cmdx/rspec/have_empty_context.rb
149
+ - lib/cmdx/rspec/have_empty_metadata.rb
149
150
  - lib/cmdx/rspec/have_matching_context.rb
151
+ - lib/cmdx/rspec/have_matching_metadata.rb
150
152
  - lib/cmdx/rspec/version.rb
151
153
  - src/cmdx-rspec-logo.png
152
154
  homepage: https://github.com/drexed/cmdx-rspec
@@ -155,9 +157,9 @@ licenses:
155
157
  metadata:
156
158
  homepage_uri: https://github.com/drexed/cmdx-rspec
157
159
  source_code_uri: https://github.com/drexed/cmdx-rspec
158
- changelog_uri: https://github.com/drexed/cmdx-rspec/blob/main/CHANGELOG.md
160
+ changelog_uri: https://github.com/drexed/cmdx-rspec/blob/master/CHANGELOG.md
159
161
  bug_tracker_uri: https://github.com/drexed/cmdx-rspec/issues
160
- documentation_uri: https://github.com/drexed/cmdx-rspec/blob/main/README.md
162
+ documentation_uri: https://github.com/drexed/cmdx-rspec/blob/master/README.md
161
163
  rubygems_mfa_required: 'true'
162
164
  rdoc_options: []
163
165
  require_paths:
@@ -173,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
175
  - !ruby/object:Gem::Version
174
176
  version: '0'
175
177
  requirements: []
176
- rubygems_version: 3.7.1
178
+ rubygems_version: 3.7.2
177
179
  specification_version: 4
178
180
  summary: Simple CMDx task testing via RSpec matchers.
179
181
  test_files: []