Module: RSpec::Given::HaveFailed
- Defined in:
- lib/rspec/given/have_failed.rb
Defined Under Namespace
Classes: HaveFailedMatcher
Instance Method Summary collapse
- #failure(error = Exception, message = nil, &block) ⇒ Object
-
#have_failed(error = Exception, message = nil, &block) ⇒ Object
(also: #have_raised)
Simular to raise_error(…), but reads a bit better when using a failure result from a when clause.
Instance Method Details
#failure(error = Exception, message = nil, &block) ⇒ Object
73 74 |
# File 'lib/rspec/given/have_failed.rb', line 73 def failure(error=Exception, =nil, &block) end |
#have_failed(error = Exception, message = nil, &block) ⇒ Object Also known as: have_raised
Simular to raise_error(…), but reads a bit better when using a failure result from a when clause.
Typical Usage:
When(:result) { fail "OUCH" }
Then { result.should have_failed(StandardError, /OUCH/) }
When(:result) { good_code }
Then { result.should_not have_failed }
:call-seq:
have_failed([exception_class [, message_pattern]])
have_failed([exception_class [, message_pattern]]) { |ex| ... }
68 69 70 |
# File 'lib/rspec/given/have_failed.rb', line 68 def have_failed(error=Exception, =nil, &block) HaveFailedMatcher.new(error, , &block) end |