module RSpec::Expectations::ExpectationHelper
@private
Public Class Methods
# File rspec-expectations/lib/rspec/expectations/handler.rb, line 7 def self.check_message(msg) unless msg.nil? || msg.respond_to?(:to_str) || msg.respond_to?(:call) RSpec.warning( "ignoring the provided expectation message argument" \ "(#{ msg.inspect }) since it is not a string or a proc" ) end end
# File rspec-expectations/lib/rspec/expectations/handler.rb, line 24 def self.handle_failure(matcher, message, failure_message_method) message = message.call if message.respond_to?(:call) message ||= matcher.__send__(failure_message_method) if matcher.respond_to?(:diffable?) && matcher.diffable? ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual else ::RSpec::Expectations.fail_with message end end
# File rspec-expectations/lib/rspec/expectations/handler.rb, line 16 def self.with_matcher(handler, matcher, message) check_message(message) yield matcher ensure ::RSpec::Matchers.last_expectation_handler = handler ::RSpec::Matchers.last_matcher = matcher end