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

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



21
22
23
24
# File 'lib/rspec/rails/mocks.rb', line 21

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

#new_record?Boolean

Returns:

  • (Boolean)


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

def new_record?
  !persisted?
end