Module: RSpec::Rails::Mocks::ActiveModelStubExtensions

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

Instance Method Summary collapse

Instance Method Details

#as_new_recordObject



106
107
108
109
110
# File 'lib/rspec/rails/mocks.rb', line 106

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

#persisted?Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/rspec/rails/mocks.rb', line 112

def persisted?
  true
end