class RSpec::Matchers::BuiltIn::YieldWithArgs

def all_args_match?

def all_args_match?
  return false if @expected.size != @actual.size
  @expected.zip(@actual).all? do |expected, actual|
    expected === actual || actual == expected
  end
end

def args_match?

def args_match?
  if @expected.empty? # expect {...}.to yield_with_args
    @positive_args_failure = "yielded with no arguments" if @actual.empty?
    return !@actual.empty?
  end
  unless match = all_args_match?
    @positive_args_failure = "yielded with unexpected arguments" +
      "\nexpected: #{@expected.inspect}" +
      "\n     got: #{@actual.inspect} (compared using === and ==)"
  end
  match
end

def description

def description
  desc = "yield with args"
  desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" unless @expected.empty?
  desc
end

def failure_message_for_should

def failure_message_for_should
  "expected given block to yield with arguments, but #{positive_failure_reason}"
end

def failure_message_for_should_not

def failure_message_for_should_not
  "expected given block not to yield with arguments, but #{negative_failure_reason}"
end

def initialize(*args)

def initialize(*args)
  @expected = args
end

def matches?(block)

def matches?(block)
  @probe = YieldProbe.probe(block)
  @actual = @probe.single_yield_args
  @probe.yielded_once?(:yield_with_args) && args_match?
end

def negative_failure_reason

def negative_failure_reason
  if all_args_match?
    "yielded with expected arguments" +
      "\nexpected not: #{@expected.inspect}" +
      "\n         got: #{@actual.inspect} (compared using === and ==)"
  else
    "did"
  end
end

def positive_failure_reason

def positive_failure_reason
  if @probe.num_yields.zero?
    "did not yield"
  else
    @positive_args_failure
  end
end

def supports_block_expectations?

Other tags:
    Private: -
def supports_block_expectations?
  true
end