Class: Boxes::Testing::Matchers::BaseMatcher
- Inherits:
-
Object
- Object
- Boxes::Testing::Matchers::BaseMatcher
- Defined in:
- lib/boxes/testing/matchers/base_matcher.rb
Direct Known Subclasses
Constant Summary collapse
- UNDEFINED =
we can’t compare to nil, because we might want nil
Object.new.freeze
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Instance Method Summary collapse
-
#initialize(expected = UNDEFINED) ⇒ BaseMatcher
constructor
A new instance of BaseMatcher.
- #matches?(actual) ⇒ Boolean
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
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
5 6 7 |
# File 'lib/boxes/testing/matchers/base_matcher.rb', line 5 def actual @actual end |
#expected ⇒ Object (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
14 15 16 17 |
# File 'lib/boxes/testing/matchers/base_matcher.rb', line 14 def matches?(actual) @actual = actual match(actual, expected) end |