Class: Matchi::RaiseException
- Inherits:
- BasicObject
- Defined in:
- lib/matchi/raise_exception.rb
Overview
**Expecting errors** matcher.
Instance Method Summary collapse
-
#initialize(expected) ⇒ RaiseException
constructor
Initialize the matcher with a descendant of class Exception.
-
#matches? ⇒ Boolean
Comparison between actual and expected values.
Constructor Details
#initialize(expected) ⇒ RaiseException
Initialize the matcher with a descendant of class Exception.
10 11 12 |
# File 'lib/matchi/raise_exception.rb', line 10 def initialize(expected) @expected = expected end |
Instance Method Details
#matches? ⇒ Boolean
Returns Comparison between actual and expected values.
21 22 23 24 25 26 27 |
# File 'lib/matchi/raise_exception.rb', line 21 def matches? yield rescue @expected true else false end |