Module: RSpec::Rails::Mocks::ActiveModelInstanceMethods

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

Instance Method Summary collapse

Instance Method Details

#as_new_recordObject



9
10
11
12
13
# File 'lib/rspec/rails/mocks.rb', line 9

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

#persisted?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rspec/rails/mocks.rb', line 15

def persisted?
  true
end