class Minitest::Mock

def expect(name, retval, args = [], &blk)

def expect(name, retval, args = [], &blk)
  name = name.to_sym
  if block_given?
    raise ArgumentError, "args ignored when block given" unless args.empty?
    @expected_calls[name] << { :retval => retval, :block => blk }
  else
    raise ArgumentError, "args must be an array" unless Array === args
    @expected_calls[name] << { :retval => retval, :args => args }
  end
  self
end