Stubs `persisted` to return false and `id` to return nil
# File lib/rspec/rails/mocks.rb, line 152 def as_new_record self.stub(:persisted?) { false } self.stub(:id) { nil } self end
Returns `true` by default. Override with a stub.
# File lib/rspec/rails/mocks.rb, line 159 def persisted? true end