Method: RSpec::Matchers#raise_error
- Defined in:
- lib/rspec/matchers.rb
#raise_error(error = Exception, message = nil, &block) ⇒ Object Also known as: raise_exception
With no args, matches if any error is raised. With a named error, matches only if that specific error is raised. With a named error and messsage specified as a String, matches only if both match. With a named error and messsage specified as a Regexp, matches only if both match. Pass an optional block to perform extra verifications on the exception matched
524 525 526 |
# File 'lib/rspec/matchers.rb', line 524 def raise_error(error=Exception, =nil, &block) BuiltIn::RaiseError.new(error, , &block) end |