Method: RSpec::Expectations.fail_with
- Defined in:
- lib/rspec/expectations/fail_with.rb
.fail_with(message, expected = nil, actual = nil) ⇒ Object
Raises an RSpec::Expectations::ExpectationNotMetError with message.
Adds a diff to the failure message when expected and actual are
both present.
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rspec/expectations/fail_with.rb', line 27 def fail_with(, expected=nil, actual=nil) unless raise ArgumentError, "Failure message is nil. Does your matcher define the " \ "appropriate failure_message[_when_negated] method to return a string?" end = ::RSpec::Matchers::MultiMatcherDiff.from(expected, actual).(, differ) RSpec::Support.notify_failure(RSpec::Expectations::ExpectationNotMetError.new ) end |