Class: Spectus::Requirement::Base
- Inherits:
-
Object
- Object
- Spectus::Requirement::Base
- Defined in:
- lib/spectus/requirement/base.rb
Overview
Requirement level’s base class.
Direct Known Subclasses
Instance Method Summary collapse
-
#call ⇒ ::Expresenter::Pass
Test result.
-
#initialize(matcher:, negate:) ⇒ Base
constructor
Initialize the requirement level class.
-
#inspect ⇒ String
A string containing a human-readable representation of the definition.
Constructor Details
#initialize(matcher:, negate:) ⇒ Base
Initialize the requirement level class.
15 16 17 18 |
# File 'lib/spectus/requirement/base.rb', line 15 def initialize(matcher:, negate:) @matcher = matcher @negate = negate end |
Instance Method Details
#call ⇒ ::Expresenter::Pass
Test result.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/spectus/requirement/base.rb', line 28 def call(&) test = ::TestTube.invoke(matcher: @matcher, negate: @negate, &) ::Expresenter.call(passed?(test)).with( actual: test.actual, definition: @matcher.to_s, error: test.error, expected: @matcher.expected, got: test.got, level: self.class.level, negate: @negate ) end |
#inspect ⇒ String
A string containing a human-readable representation of the definition.
57 58 59 |
# File 'lib/spectus/requirement/base.rb', line 57 def inspect "#<#{self.class.level} #{@matcher.inspect} negate=#{@negate}>" end |