Class: Expresenter::Pass
- Inherits:
-
Object
- Object
- Expresenter::Pass
- Includes:
- Base
- Defined in:
- lib/expresenter/pass.rb
Overview
The class that is responsible for reporting that the expectation is true.
Instance Attribute Summary
Attributes included from Base
#actual, #error, #expected, #got, #level, #matcher
Class Method Summary collapse
-
.with(**details) ⇒ Pass
A passed spec result.
Instance Method Summary collapse
-
#char ⇒ String
Express the result with one char.
-
#emoji ⇒ String
Express the result with one emoji.
-
#failed? ⇒ Boolean
Did the test fail?.
-
#failure? ⇒ Boolean
The state of failure.
-
#info? ⇒ Boolean
The state of info.
-
#to_sym ⇒ Symbol
Identify the state of the result.
-
#warning? ⇒ Boolean
The state of warning.
Methods included from Base
#colored_char, #colored_string, #definition, #error?, #initialize, #inspect, #maybe_negate, #negate?, #passed?, #success?, #summary, #titre, #to_s, #valid?
Class Method Details
.with(**details) ⇒ Pass
Returns A passed spec result.
11 12 13 |
# File 'lib/expresenter/pass.rb', line 11 def self.with(**details) new(**details) end |
Instance Method Details
#char ⇒ String
Express the result with one char.
58 59 60 61 62 63 64 65 66 |
# File 'lib/expresenter/pass.rb', line 58 def char if success? "." elsif warning? "W" else "I" end end |
#emoji ⇒ String
Express the result with one emoji.
71 72 73 74 75 76 77 78 79 |
# File 'lib/expresenter/pass.rb', line 71 def emoji if success? "✅" elsif warning? "⚠️" else "💡" end end |
#failed? ⇒ Boolean
Did the test fail?
20 21 22 |
# File 'lib/expresenter/pass.rb', line 20 def failed? false end |
#failure? ⇒ Boolean
The state of failure.
27 28 29 |
# File 'lib/expresenter/pass.rb', line 27 def failure? false end |
#info? ⇒ Boolean
The state of info.
34 35 36 |
# File 'lib/expresenter/pass.rb', line 34 def info? !error.nil? end |
#to_sym ⇒ Symbol
Identify the state of the result.
48 49 50 51 52 53 |
# File 'lib/expresenter/pass.rb', line 48 def to_sym return :success if success? return :warning if warning? :info end |
#warning? ⇒ Boolean
The state of warning.
41 42 43 |
# File 'lib/expresenter/pass.rb', line 41 def warning? got.equal?(false) end |