Class: Easytest::Matcher::Base
- Inherits:
-
Object
- Object
- Easytest::Matcher::Base
- Defined in:
- lib/easytest/matcher/base.rb
Direct Known Subclasses
Be, BeA, ContainExactly, Empty, Equal, False, HaveAttributes, Include, InstanceOf, KindOf, Match, Nil, Raise, RaiseNothing, Satisfy, True
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#negate ⇒ Object
(also: #negate?)
readonly
Returns the value of attribute negate.
Instance Method Summary collapse
-
#initialize(actual:, expected:, negate: false) ⇒ Base
constructor
A new instance of Base.
- #match! ⇒ Object
- #match? ⇒ Boolean
Constructor Details
#initialize(actual:, expected:, negate: false) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/easytest/matcher/base.rb', line 9 def initialize(actual:, expected:, negate: false) @actual = actual @expected = expected @negate = negate end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
4 5 6 |
# File 'lib/easytest/matcher/base.rb', line 4 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
5 6 7 |
# File 'lib/easytest/matcher/base.rb', line 5 def expected @expected end |
#negate ⇒ Object (readonly) Also known as: negate?
Returns the value of attribute negate.
6 7 8 |
# File 'lib/easytest/matcher/base.rb', line 6 def negate @negate end |
Instance Method Details
#match! ⇒ Object
19 20 21 22 23 |
# File 'lib/easytest/matcher/base.rb', line 19 def match! matched = match? matched = !matched if negate? raise_match_error unless matched end |
#match? ⇒ Boolean
15 16 17 |
# File 'lib/easytest/matcher/base.rb', line 15 def match? raise NotImplementedError end |