Module: RSpec::Rails::Mocks::ActiveRecordInstanceMethods

Defined in:
lib/rspec/rails/mocks.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



25
26
27
28
# File 'lib/rspec/rails/mocks.rb', line 25

def destroy
  self.stub(:persisted?) { false }
  self.stub(:id) { nil }
end

#new_record?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/rspec/rails/mocks.rb', line 30

def new_record?
  !persisted?
end