cmdx-rspec 1.0.0 → 1.1.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: 1ed75f972481a1a428a86ce5ff19f3a804126f1e305097886f983cd102a00ced
4
- data.tar.gz: 2bdc655439c8bafb3d865d13018290cd935262edef756596aa73b23dd9f0e85d
3
+ metadata.gz: 6d7e467dfe5e14a9de4e6e0b2f0dc11103b2f7da3950520cd94ffed429b0eef6
4
+ data.tar.gz: 0b6af1c86e14a62c8d3a4244576b5805c667788b81e276ca3e89ab03e9f293a9
5
5
  SHA512:
6
- metadata.gz: 711527fe0d0a79306f45dda1918aeaf656926064e5c7573dabb33785afb52d9b013ca663115340c222b2502900740f235741598b410d5861bc1fb26618d87357
7
- data.tar.gz: 666bc45fdfb94f09d378c8a8adbee16f15d66e8069e2b324069602274b7ec49aacf79f64e98d8dd6a472137c2937bb9d465f212c7b7d787e6869319968f9ebdf
6
+ metadata.gz: 338465ba22c6e888adbf36f973fc56479ec58b8fb2bb3635f3c028fa02783e90fbb408d68d4399a0cb9515e7ad6bbbd6e7e1da549af2ac7258abdf87c4208b31
7
+ data.tar.gz: dd456ab9cb4c907272fc8813e93d18cae68d85f09e2a2f7cc8e019a156d7911a7f99e7a267215d98cec4b0800248d4294ddf5471e1df1832fbb7629875eb38e3
data/CHANGELOG.md CHANGED
@@ -6,7 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [1.0.0] - 2025-11-09
9
+ ## [1.1.0] - 2025-11-08
10
+
11
+ ### Added
12
+ - Added unstub helpers
13
+
14
+ ## [1.0.0] - 2025-11-08
10
15
 
11
16
  ### Added
12
17
  - Added mock and stub helpers
data/README.md CHANGED
@@ -59,7 +59,11 @@ it "returns skipped" do
59
59
  expect(result).to have_skipped
60
60
 
61
61
  # Custom result
62
- expect(result).to have_skipped(reason: "Skipping for a custom reason")
62
+ expect(result).to have_skipped(
63
+ reason: "Skipping for a custom reason",
64
+ cause: be_a(CMDx::SkipFault)
65
+ # Other members of `result.to_h`...
66
+ )
63
67
  end
64
68
  ```
65
69
 
@@ -75,7 +79,11 @@ it "returns failure" do
75
79
  expect(result).to have_failed
76
80
 
77
81
  # Custom result
78
- expect(result).to have_failed(reason: "Failed for a custom reason")
82
+ expect(result).to have_failed(
83
+ reason: "Failed for a custom reason",
84
+ cause: be_a(NoMethodError)
85
+ # Other members of `result.to_h`...
86
+ )
79
87
  end
80
88
  ```
81
89
 
@@ -163,7 +171,7 @@ end
163
171
 
164
172
  Helper methods for stubbing CMDx command execution.
165
173
 
166
- ### Execution types
174
+ #### Types
167
175
 
168
176
  ```ruby
169
177
  it "stubs task executions by type" do
@@ -179,11 +187,7 @@ it "stubs task executions by type" do
179
187
 
180
188
  # Your specs...
181
189
  end
182
- ```
183
-
184
- ### Options
185
190
 
186
- ```ruby
187
191
  it "stubs task with arguments" do
188
192
  # eg: SomeTask.execute(some: "value")
189
193
  stub_task_success(SomeTask, some: "value")
@@ -195,6 +199,8 @@ it "stubs task with arguments" do
195
199
  end
196
200
  ```
197
201
 
202
+ #### Options
203
+
198
204
  ```ruby
199
205
  it "stubs task with metadata" do
200
206
  stub_task_success(SomeTask, metadata: { some: "value" })
@@ -215,11 +221,25 @@ it "stubs task with a custom cause" do
215
221
  end
216
222
  ```
217
223
 
224
+ #### Reset
225
+
226
+ ```ruby
227
+ it "unstubs task executions by type" do
228
+ # eg: SomeTask.execute
229
+ unstub_task(SomeTask)
230
+
231
+ # eg: SomeTask.execute!
232
+ unstub_task!(SomeTask)
233
+
234
+ # Your specs...
235
+ end
236
+ ```
237
+
218
238
  ### Mocks
219
239
 
220
240
  Helper methods for setting expectations on CMDx command execution.
221
241
 
222
- ### Execution types
242
+ #### Types
223
243
 
224
244
  ```ruby
225
245
  it "mocks task executions by type" do
@@ -231,11 +251,7 @@ it "mocks task executions by type" do
231
251
 
232
252
  # Your specs...
233
253
  end
234
- ```
235
254
 
236
- ### Options
237
-
238
- ```ruby
239
255
  it "mocks task with arguments" do
240
256
  # eg: SomeTask.execute(some: "value")
241
257
  expect_task_execution(SomeTask, some: "value")
@@ -205,6 +205,34 @@ module CMDx
205
205
  result
206
206
  end
207
207
 
208
+ # Unstubs a command's :execute method.
209
+ #
210
+ # @param command [Class] The command class to unstub execution on
211
+ #
212
+ # @return [void]
213
+ #
214
+ # @example Unstubbing execute
215
+ # unstub_task(MyCommand)
216
+ #
217
+ # MyCommand.execute
218
+ def unstub_task(command)
219
+ allow(command).to receive(:execute).and_call_original
220
+ end
221
+
222
+ # Unstubs a command's :execute! method.
223
+ #
224
+ # @param command [Class] The command class to unstub execution on
225
+ #
226
+ # @return [void]
227
+ #
228
+ # @example Unstubbing execute!
229
+ # unstub_task!(MyCommand)
230
+ #
231
+ # MyCommand.execute!
232
+ def unstub_task!(command)
233
+ allow(command).to receive(:execute!).and_call_original
234
+ end
235
+
208
236
  # Sets up an expectation that a command will receive :execute with the given context.
209
237
  #
210
238
  # @param command [Class] The command class to expect execution on
@@ -3,7 +3,7 @@
3
3
  module CMDx
4
4
  module RSpec
5
5
 
6
- VERSION = "1.0.0"
6
+ VERSION = "1.1.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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez