Module: RSpec::Given::HaveFailed

Defined in:
lib/rspec/given/have_failed.rb

Instance Method Summary collapse

Instance Method Details

#have_failed(*args, &block) ⇒ Object

Alias for raise_error(…), but reads a bit better when using a failure result from a when clause.

NOTE: This is new for 1.6.0.beta.1. A name change for this method is possible.

Typical Usage:

When(:result) { fail "OUCH" }
Then { result.should have_failed(StandardError, /OUCH/) }

:call-seq:

have_failed([exception_class [, message_pattern]])


19
20
21
# File 'lib/rspec/given/have_failed.rb', line 19

def have_failed(*args, &block)
  raise_error(*args, &block)
end