cmdx-rspec 1.1.0 → 1.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +10 -0
- data/lib/cmdx/rspec/helpers.rb +28 -0
- data/lib/cmdx/rspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 65acfca8209e73048a17abf0bc8c9b260904be2d222eb8d2f620c39452da0d0b
|
|
4
|
+
data.tar.gz: 64c7756f01efe07324193ca891bf4ce841361e2ce93235437b0a63ed4c74bfea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e05b1817afbfacd6d8fca1bf97b3f1b94ba9fdff4ab9acbb089655641430cc636efd9a60cdadc506d347ab58b907b7b11e3991eff22655a24b5b7c5660599d75
|
|
7
|
+
data.tar.gz: 5b37bad356a2973d7ab0030afe938a8baa2b8a86d62a769e1ecd9bc7ffa31c5aa424b24016b14cb564e4e5db48c10b7dfce58dfbc626a81666212ae3b77923aa
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -261,6 +261,16 @@ it "mocks task with arguments" do
|
|
|
261
261
|
|
|
262
262
|
# Your specs...
|
|
263
263
|
end
|
|
264
|
+
|
|
265
|
+
it "mocks no task executions by type" do
|
|
266
|
+
# eg: SomeTask.execute
|
|
267
|
+
expect_no_task_execution(SomeTask)
|
|
268
|
+
|
|
269
|
+
# eg: SomeTask.execute!
|
|
270
|
+
expect_no_task_execution!(SomeTask)
|
|
271
|
+
|
|
272
|
+
# Your specs...
|
|
273
|
+
end
|
|
264
274
|
```
|
|
265
275
|
|
|
266
276
|
## Development
|
data/lib/cmdx/rspec/helpers.rb
CHANGED
|
@@ -281,6 +281,34 @@ module CMDx
|
|
|
281
281
|
end
|
|
282
282
|
end
|
|
283
283
|
|
|
284
|
+
# Sets up an expectation that a command will not receive :execute.
|
|
285
|
+
#
|
|
286
|
+
# @param command [Class] The command class to expect execution on
|
|
287
|
+
#
|
|
288
|
+
# @return [RSpec::Mocks::MessageExpectation] The RSpec expectation object
|
|
289
|
+
#
|
|
290
|
+
# @example Expecting no execution
|
|
291
|
+
# expect_no_task_execution(MyCommand)
|
|
292
|
+
#
|
|
293
|
+
# MyCommand.execute
|
|
294
|
+
def expect_no_task_execution(command)
|
|
295
|
+
expect(command).not_to receive(:execute)
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
# Sets up an expectation that a command will not receive :execute!.
|
|
299
|
+
#
|
|
300
|
+
# @param command [Class] The command class to expect execution on
|
|
301
|
+
#
|
|
302
|
+
# @return [RSpec::Mocks::MessageExpectation] The RSpec expectation object
|
|
303
|
+
#
|
|
304
|
+
# @example Expecting no execution!
|
|
305
|
+
# expect_no_task_execution!(MyCommand)
|
|
306
|
+
#
|
|
307
|
+
# MyCommand.execute!
|
|
308
|
+
def expect_no_task_execution!(command)
|
|
309
|
+
expect(command).not_to receive(:execute!)
|
|
310
|
+
end
|
|
311
|
+
|
|
284
312
|
end
|
|
285
313
|
end
|
|
286
314
|
end
|
data/lib/cmdx/rspec/version.rb
CHANGED