class RSpec::Mocks::Mock

def initialize(name=nil, stubs_and_options={})

only)
Creates a new test double with a +name+ (that will be used in error messages
def initialize(name=nil, stubs_and_options={})
  if name.is_a?(Hash) && stubs_and_options.empty?
    stubs_and_options = name
    @name = nil
  else
    @name = name
  end
  @options = extract_options(stubs_and_options)
  assign_stubs(stubs_and_options)
end