Class: TestTube::Passer

Inherits:
Base
  • Object
show all
Defined in:
lib/test_tube/passer.rb

Overview

Evaluate an actual value passed in parameter.

Instance Attribute Summary

Attributes inherited from Base

#actual, #error, #got

Instance Method Summary collapse

Methods inherited from Base

#inspect

Constructor Details

#initialize(input, matcher:, negate:) ⇒ Passer

Class initializer.

Parameters:

  • input (#object_id)

    An actual value to test.

  • matcher (#matches?)

    A matcher.

  • negate (Boolean)

    Invert the matcher or not.


13
14
15
16
17
18
# File 'lib/test_tube/passer.rb', line 13

def initialize(input, matcher:, negate:)
  super()

  @actual = input
  @got = negate ^ matcher.matches? { input }
end