spectus 6.0.0 → 6.0.1
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/README.md +6 -2
- data/lib/spectus/result.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9f26d85caf30a154e45b9a762ac0e53b447fed54f37485c5f6f75d0900c4d071
|
|
4
|
+
data.tar.gz: 1f94678946741fd58dde08354927a1a7e6fde7b608fc19f0243a1ba78c1a1b2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89257bafa377028371d0d1c5da31c8ee454fa23012c565efdf29dba5cbb6350ba145b1636b7b96607aab30463d306f1f687274bd7c0db1c2c2440494fbe613c4
|
|
7
|
+
data.tar.gz: f6955ba82d49192279a172ed5026b40656af8f655d1dad09345423c6c3d7d7ac8f0bad700cf189d39da6642ded47276d01bcf2f37288c4a4074d321f71d2f04b
|
data/README.md
CHANGED
|
@@ -62,7 +62,7 @@ A `Spectus::Result` is plain data, frozen: symbols, booleans and frozen strings
|
|
|
62
62
|
| `negate` | `true` or `false` |
|
|
63
63
|
| `outcome` | `:success`, `:warning`, `:info`, `:failure` or `:error` |
|
|
64
64
|
| `description` | the matcher, as its `to_s` wrote it: `eq 42` |
|
|
65
|
-
| `actual` | the value the block returned, as its `inspect` wrote it, or the exception it raised, whether the matcher rescued it or not; `nil` when the matcher did not call the block |
|
|
65
|
+
| `actual` | the value the block returned, as its `inspect` wrote it, or the exception it raised, whether the matcher rescued it or not; `nil` when the matcher did not call the block, or when the block raised an exception Defi does not keep and the matcher rescued it |
|
|
66
66
|
| `error_class` | the class of the exception that came out of `match?`, or `TypeError` for an answer that was not `true` or `false`; `nil` otherwise |
|
|
67
67
|
| `error_message` | its message |
|
|
68
68
|
| `backtrace` | its backtrace, when it has one, library frames included: a runner filters by path |
|
|
@@ -73,10 +73,14 @@ The texts are read defensively: an `inspect` or a `message` that raises or does
|
|
|
73
73
|
|
|
74
74
|
## Exceptions
|
|
75
75
|
|
|
76
|
-
`call` raises `ArgumentError` without a block and `TypeError` when the `to_s` of the matcher is not a `String`; the matcher is test code, trusted, and what its `to_s` raises goes through. The block and `match?` run under the policy of Defi: the exceptions a method raises on its own, a `StandardError`, a `ScriptError` (such as `NotImplementedError`), a `SystemStackError` or the `SystemExit` of an `exit`, end in the result (as an error, or as an info for a MAY), while an `Interrupt`, a `SignalException`, a `NoMemoryError`, the exception a `Timeout` uses to end its block and any other subclass of `Exception` go through, whether the block or the matcher raised them. Spectus never sees what a matcher rescues itself:
|
|
76
|
+
`call` raises `ArgumentError` without a block and `TypeError` when the `to_s` of the matcher is not a `String`; the matcher is test code, trusted, and what its `to_s` raises goes through. The block and `match?` run under the policy of Defi: the exceptions a method raises on its own, a `StandardError`, a `ScriptError` (such as `NotImplementedError`), a `SystemStackError` or the `SystemExit` of an `exit`, end in the result (as an error, or as an info for a MAY), while an `Interrupt`, a `SignalException`, a `NoMemoryError`, the exception a `Timeout` uses to end its block and any other subclass of `Exception` go through, whether the block or the matcher raised them. Spectus never sees what a matcher rescues itself: `Matchi::RaiseException` rescues a `SystemExit`, so an `exit` inside its block is a failed match, not an error, and `Matchi::RaiseException.new(Interrupt)` rescues an `Interrupt`, a success without an actual value.
|
|
77
77
|
|
|
78
78
|
The block runs inside `match?`, as many times as the matcher calls it, and without arguments: a lambda that expects some raises `ArgumentError`, which ends in the result. `actual` is the block's last value. The exception it raises is raised again inside the matcher, the same object with its own cause, as Defi does it.
|
|
79
79
|
|
|
80
|
+
## Changes in 6.0.1
|
|
81
|
+
|
|
82
|
+
- Documentation: `actual` is also `nil` when the block raised an exception Defi does not keep and the matcher rescued it, as `Matchi::RaiseException.new(Interrupt)` does; what `Matchi::RaiseException` rescues is described as of matchi 6.0.
|
|
83
|
+
|
|
80
84
|
## Changes in 6.0
|
|
81
85
|
|
|
82
86
|
Compared with 5.0.2:
|
data/lib/spectus/result.rb
CHANGED
|
@@ -19,7 +19,8 @@ module Spectus
|
|
|
19
19
|
# @return [String, nil] the value the block produced, as its `inspect`
|
|
20
20
|
# wrote it, or the exception it raised (which is also the error when
|
|
21
21
|
# the matcher let it through); `nil` when the matcher did not call the
|
|
22
|
-
# block
|
|
22
|
+
# block, or the block raised an exception Defi does not keep and the
|
|
23
|
+
# matcher rescued it
|
|
23
24
|
# @!attribute [r] error_class
|
|
24
25
|
# @return [String, nil] the class of the exception that came out of
|
|
25
26
|
# `match?`, or `TypeError` for an answer that was not true or false
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spectus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.
|
|
4
|
+
version: 6.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cyril Kato
|
|
@@ -41,7 +41,7 @@ licenses:
|
|
|
41
41
|
- MIT
|
|
42
42
|
metadata:
|
|
43
43
|
bug_tracker_uri: https://github.com/fixrb/spectus/issues
|
|
44
|
-
changelog_uri: https://github.com/fixrb/spectus#changes-in-
|
|
44
|
+
changelog_uri: https://github.com/fixrb/spectus#changes-in-601
|
|
45
45
|
documentation_uri: https://rubydoc.info/gems/spectus
|
|
46
46
|
rubygems_mfa_required: 'true'
|
|
47
47
|
source_code_uri: https://github.com/fixrb/spectus
|