Class: Matchi::Matcher::RaiseException
- Defined in:
- lib/matchi/matcher/raise_exception.rb
Overview
**Expecting errors** matcher.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(expected) ⇒ RaiseException
constructor
Initialize the matcher with a descendant of class Exception.
-
#matches? ⇒ Boolean
Boolean comparison between the actual value and the expected value.
Methods inherited from Base
Constructor Details
#initialize(expected) ⇒ RaiseException
Initialize the matcher with a descendant of class Exception.
15 16 17 18 |
# File 'lib/matchi/matcher/raise_exception.rb', line 15 def initialize(expected) super() @expected = expected end |
Instance Method Details
#matches? ⇒ Boolean
Boolean comparison between the actual value and the expected value.
30 31 32 33 34 35 36 |
# File 'lib/matchi/matcher/raise_exception.rb', line 30 def matches?(*, **) yield rescue expected => _e true else false end |