class RSpec::Mocks::BaseExpectation

def and_yield(*args, &block)

def and_yield(*args, &block)
  if @args_to_yield_were_cloned
    @args_to_yield.clear
    @args_to_yield_were_cloned = false
  end
  
  if block
    require 'rspec/mocks/extensions/instance_exec'
    @eval_context = Object.new
    @eval_context.extend RSpec::Mocks::InstanceExec
    yield @eval_context
  end
  
  @args_to_yield << args
  self
end