Module: RSpec::Rails::Mocks::ActiveModelStubExtensions
- Defined in:
- lib/rspec/rails/mocks.rb
Instance Method Summary (collapse)
-
- (Object) as_new_record
Stubs
persisted
to return false andid
to return nil. -
- (Boolean) persisted?
Returns
true
by default.
Instance Method Details
- (Object) as_new_record
Stubs persisted
to return false and id
to return nil
179 180 181 182 183 |
# File 'lib/rspec/rails/mocks.rb', line 179 def as_new_record RSpec::Mocks.(self, :persisted?).and_return(false) RSpec::Mocks.(self, :id).and_return(nil) self end |
- (Boolean) persisted?
Returns true
by default. Override with a stub.
186 187 188 |
# File 'lib/rspec/rails/mocks.rb', line 186 def persisted? true end |