class RSpec::Mocks::BaseExpectation

def invoke_with_yield(&block)

def invoke_with_yield(&block)
  if block.nil?
    @error_generator.raise_missing_block_error @args_to_yield
  end
  value = nil
  @args_to_yield.each do |args_to_yield_this_time|
    if block.arity > -1 && args_to_yield_this_time.length != block.arity
      @error_generator.raise_wrong_arity_error args_to_yield_this_time, block.arity
    end
    value = eval_block(*args_to_yield_this_time, &block)
  end
  value
end