Class: Smartest::CompoundMatcher

Inherits:
Matcher
  • Object
show all
Defined in:
lib/smartest/matchers.rb

Direct Known Subclasses

AndMatcher, OrMatcher

Constant Summary collapse

NEGATED_EXPECTATION_ERROR =
"not_to does not support matcher composition with .and or .or"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Matcher

#and, #description, #or

Constructor Details

#initialize(*matchers) ⇒ CompoundMatcher

Returns a new instance of CompoundMatcher.



76
77
78
79
80
81
# File 'lib/smartest/matchers.rb', line 76

def initialize(*matchers)
  @matchers = matchers.flat_map do |matcher|
    matcher.is_a?(self.class) ? matcher.matchers : matcher
  end
  reset_result
end

Instance Attribute Details

#matchersObject (readonly)

Returns the value of attribute matchers.



72
73
74
# File 'lib/smartest/matchers.rb', line 72

def matchers
  @matchers
end

Instance Method Details

#negated_expectation_errorObject



87
88
89
# File 'lib/smartest/matchers.rb', line 87

def negated_expectation_error
  NEGATED_EXPECTATION_ERROR
end

#supports_negated_expectation?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/smartest/matchers.rb', line 83

def supports_negated_expectation?
  false
end