expresenter 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -22
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb63ac6ae40169d1d98b61f79fc0b4f90fe2977d80baf5949c0ba6c9853cfe59
4
- data.tar.gz: 313bc8ef04d5916a19c0bef468835fb8b59c9dfb5b16a58b3cd11ea4b85c07f3
3
+ metadata.gz: f131ba55891e3abc10e518e86df59ab1ed2051f8c8dcdaddfe06ad40f62bde85
4
+ data.tar.gz: 1e717b60df591416909fa9d4d1772347924dd99904e2d5f85efb6cfbd4ba0bdb
5
5
  SHA512:
6
- metadata.gz: f79e27247f4ec36d4e77ac7dd34f77486dac59b57a917992887eb0e8d7cfd308a39b429557e23bffaebc0d5e8799ed5584031c06dad043385755cd9f4340263a
7
- data.tar.gz: fa66a109000fbc04de1122d92727b1c410e85f2d12cf3072e994a601bf4b6f8349086459398c7bcefd5ccb1f15d80b747c2e2c2df9e77e63fe820f54d2f72fd3
6
+ metadata.gz: eff6bc9cb5101af90834ee70cc856ddcd3796bb848e0c30eda86227293058dec97bcf401cd8807238282dd790fddb3d7c3792b9a304ddf96866a97c156750663
7
+ data.tar.gz: 2104cc18ff071a607e8e5a932f5c85c537f06f0f41060a849b4d6954b306e6a00dff1bf4f2f55d1e4647dbeb9b13dd5f9893287e5f531d229b189c10ffa0baa3
data/README.md CHANGED
@@ -26,32 +26,67 @@ Or install it yourself as:
26
26
 
27
27
  ## Usage
28
28
 
29
+ Assuming that an expectation is an assertion that is either `true` or `false`,
30
+ qualifying it with `MUST`, `SHOULD` and `MAY`, we can draw up several scenarios:
31
+
32
+ | Requirement levels | **MUST** | **SHOULD** | **MAY** |
33
+ | ------------------------- | -------- | ---------- | ------- |
34
+ | Implemented & Matched | `true` | `true` | `true` |
35
+ | Implemented & Not matched | `false` | `true` | `false` |
36
+ | Implemented & Exception | `false` | `false` | `false` |
37
+ | Not implemented | `false` | `false` | `true` |
38
+
39
+ Then,
40
+
41
+ * for a `true` assertion, a `Expresenter::Pass` instance can be returned;
42
+ * for a `false` assertion, a `Expresenter::Fail` exception can be raised.
43
+
44
+ Both class share a common interface.
45
+
46
+ Passed expectations can be classified as:
47
+
48
+ * ✅ success
49
+ * ⚠️ warning
50
+ * 💡 info
51
+
52
+ Failed expectations can be classified as:
53
+
54
+ * ❌ failure
55
+ * 💥 error
56
+
57
+ ## Example
58
+
29
59
  ```ruby
30
- result = Expresenter.call(true, actual: "FOO", error: nil, expected: "foo", got: true, negate: true, valid: true, matcher: :eql, level: :MUST)
31
-
32
- actual.failed? # => false
33
- actual.failure? # => false
34
- actual.info? # => false
35
- actual.warning? # => false
36
- actual.to_sym # => :success
37
- actual.char # => "."
38
- actual.emoji # => "✅"
39
- actual.passed? # => true
40
- actual.negate? # => true
41
- actual.error? # => false
42
- actual.success? # => true
43
- actual.valid? # => true
44
- actual.inspect # => "Expresenter::Pass(actual: \"FOO\", error: nil, expected: \"foo\", got: true, matcher: :eql, negate: true, level: :MUST, valid: true)"
45
- actual.definition # => "eql \"foo\""
46
- actual.maybe_negate # => " not"
47
- actual.summary # => "expected \"FOO\" not to eql \"foo\""
48
- actual.colored_char # => "\e[32m.\e[0m"
49
- actual.colored_string # => "\e[32mSuccess: expected \"FOO\" not to eql \"foo\".\e[0m"
60
+ result = Expresenter.call(true).with(actual: "FOO", error: nil, expected: "foo", got: true, negate: true, valid: true, matcher: :eql, level: :MUST)
61
+
62
+ result.failed? # => false
63
+ result.failure? # => false
64
+ result.info? # => false
65
+ result.warning? # => false
66
+ result.to_sym # => :success
67
+ result.char # => "."
68
+ result.emoji # => "✅"
69
+ result.passed? # => true
70
+ result.negate? # => true
71
+ result.error? # => false
72
+ result.success? # => true
73
+ result.valid? # => true
74
+ result.inspect # => "Expresenter::Pass(actual: \"FOO\", error: nil, expected: \"foo\", got: true, matcher: :eql, negate: true, level: :MUST, valid: true)"
75
+ result.definition # => "eql \"foo\""
76
+ result.maybe_negate # => " not"
77
+ result.summary # => "expected \"FOO\" not to eql \"foo\""
78
+ result.colored_char # => "\e[32m.\e[0m"
79
+ result.colored_string # => "\e[32mSuccess: expected \"FOO\" not to eql \"foo\".\e[0m"
50
80
  result.message # => "Success: expected \"FOO\" not to eql \"foo\"."
51
- actual.to_s # => "Success: expected \"FOO\" not to eql \"foo\"."
52
- actual.titre # => "Success"
81
+ result.to_s # => "Success: expected \"FOO\" not to eql \"foo\"."
82
+ result.titre # => "Success"
53
83
  ```
54
84
 
85
+ ### More Examples
86
+
87
+ A full list of unit tests can be viewed (and executed) here:
88
+ [./test.rb](https://github.com/fixrb/expresenter/blob/main/test.rb)
89
+
55
90
  ## Contact
56
91
 
57
92
  * Home page: https://github.com/fixrb/expresenter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expresenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato