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(&block) ⇒ ::Expresenter::Pass
Test result.
-
#initialize(isolate:, matcher:, negate:) ⇒ Base
constructor
Initialize the requirement level class.
-
#inspect ⇒ String
A string containing a human-readable representation of the definition.
Constructor Details
#initialize(isolate:, matcher:, negate:) ⇒ Base
Initialize the requirement level class.
16 17 18 19 20 |
# File 'lib/spectus/requirement/base.rb', line 16 def initialize(isolate:, matcher:, negate:) @isolate = isolate @matcher = matcher @negate = negate end |
Instance Method Details
#call(&block) ⇒ ::Expresenter::Pass
Test result.
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/spectus/requirement/base.rb', line 30 def call(&block) test = ::TestTube.invoke(isolate: @isolate, matcher: @matcher, negate: @negate, &block) ::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.
59 60 61 |
# File 'lib/spectus/requirement/base.rb', line 59 def inspect "#<#{self.class.level} #{@matcher.inspect} isolate=#{@isolate} negate=#{@negate}>" end |