class Spec::Mocks::Mock

def ==(other)

be safe unless the RHS redefines == in a nonsensical manner
This is an unfortunate side effect from ActiveRecord, but this should
the comparison, we're sure the call gets delegated to the proxy target
ActiveRecords belongs_to proxy objects By making the other object run
This allows for comparing the mock to other objects that proxy such as
def ==(other)
  other == __mock_proxy
end

def assign_stubs(stubs)

def assign_stubs(stubs)
  stubs.each_pair do |message, response|
    stub!(message).and_return(response)
  end
end

def initialize(name, stubs_and_options={})

null object allowing any message to be sent to it.
* :null_object - if true, the mock object acts as a forgiving
only) == Options:
Creates a new mock with a +name+ (that will be used in error messages
def initialize(name, stubs_and_options={})
  @name = name
  @options = parse_options(stubs_and_options)
  assign_stubs(stubs_and_options)
end

def inspect

def inspect
  "#<#{self.class}:#{sprintf '0x%x', self.object_id} @name=#{@name.inspect}>"
end

def method_missing(sym, *args, &block)

def method_missing(sym, *args, &block)
  __mock_proxy.instance_eval {@messages_received << [sym, args, block]}
  begin
    return self if __mock_proxy.null_object?
    super(sym, *args, &block)
  rescue NameError
    __mock_proxy.raise_unexpected_message_error sym, *args
  end
end

def parse_options(options)

def parse_options(options)
  options.has_key?(:null_object) ? {:null_object => options.delete(:null_object)} : {}
end

def to_s

def to_s
  inspect.gsub('<','[').gsub('>',']')
end