module RSpec::Rails::Mocks::ActiveRecordInstanceMethods

def [](key)

Transforms the key to a method and calls it.
def [](key)
  send(key)
end

def destroy

Stubs +persisted?+ to return +false+ and +id+ to return +nil+.
def destroy
  self.stub(:persisted?) { false }
  self.stub(:id) { nil }
end

def new_record?

Returns the opposite of +persisted?+
def new_record?
  !persisted?
end