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
  RSpec::Mocks.allow_message(self, :persisted?).and_return(false)
  RSpec::Mocks.allow_message(self, :id).and_return(nil)
end

def new_record?

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