Class: Boxes::Testing::Matchers::BaseMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/boxes/testing/matchers/base_matcher.rb

Direct Known Subclasses

HaveExitStatusMatcher, WriteToStdoutMatcher

Constant Summary collapse

UNDEFINED =

we can’t compare to nil, because we might want nil

Object.new.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected = UNDEFINED) ⇒ BaseMatcher

Returns a new instance of BaseMatcher.



10
11
12
# File 'lib/boxes/testing/matchers/base_matcher.rb', line 10

def initialize(expected = UNDEFINED)
  @expected = expected unless UNDEFINED.equal?(expected)
end

Instance Attribute Details

#actualObject (readonly)

Returns the value of attribute actual.



5
6
7
# File 'lib/boxes/testing/matchers/base_matcher.rb', line 5

def actual
  @actual
end

#expectedObject (readonly)

Returns the value of attribute expected.



5
6
7
# File 'lib/boxes/testing/matchers/base_matcher.rb', line 5

def expected
  @expected
end

Instance Method Details

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/boxes/testing/matchers/base_matcher.rb', line 14

def matches?(actual)
  @actual = actual
  match(actual, expected)
end