module RSpec::Expectations::ExpectationHelper

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/rspec/expectations/handler.rbs

module RSpec::Expectations::ExpectationHelper
  def self.check_message: (nil msg) -> nil
  def self.modern_matcher_from: ((RSpec::Matchers::BuiltIn::BePredicate | RSpec::Matchers::BuiltIn::Include) matcher) -> (RSpec::Matchers::BuiltIn::BePredicate | RSpec::Matchers::BuiltIn::Include)
  def self.with_matcher: (Class handler, (RSpec::Matchers::BuiltIn::BePredicate | RSpec::Matchers::BuiltIn::Include) matcher, String? message) -> true
end

def self.check_message(msg)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.check_message: (nil msg) -> nil

This signature was generated using 5 samples from 1 application.

def self.check_message(msg)
  unless msg.nil? || msg.respond_to?(:to_str) || msg.respond_to?(:call)
    ::Kernel.warn [
      "WARNING: ignoring the provided expectation message argument (",
      msg.inspect,
      ") since it is not a string or a proc."
    ].join
  end
end

def self.handle_failure(matcher, message, failure_message_method)

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

def self.modern_matcher_from(matcher)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.modern_matcher_from: ((RSpec::Matchers::BuiltIn::BePredicate | RSpec::Matchers::BuiltIn::Include) matcher) -> (RSpec::Matchers::BuiltIn::BePredicate | RSpec::Matchers::BuiltIn::Include)

This signature was generated using 5 samples from 1 application.

Other tags:
    Private: -
def self.modern_matcher_from(matcher)
  LegacyMatcherAdapter::RSpec2.wrap(matcher) ||
  LegacyMatcherAdapter::RSpec1.wrap(matcher) || matcher
end

def self.with_matcher(handler, matcher, message)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.with_matcher: (Class handler, (RSpec::Matchers::BuiltIn::BePredicate | RSpec::Matchers::BuiltIn::Include) matcher, String? message) -> true

This signature was generated using 6 samples from 1 application.

def self.with_matcher(handler, matcher, message)
  check_message(message)
  matcher = modern_matcher_from(matcher)
  yield matcher
ensure
  ::RSpec::Matchers.last_expectation_handler = handler
  ::RSpec::Matchers.last_matcher = matcher
end