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

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

Instance Method Summary collapse

Instance Method Details

#as_new_recordObject



118
119
120
121
122
# File 'lib/rspec/rails/mocks.rb', line 118

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

#persisted?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/rspec/rails/mocks.rb', line 124

def persisted?
  true
end