Sha256: 8a6c9c28e342c53d3a1c3a2e9feb01edf3de2f03a915d0f68a558a4748db336e
Contents?: true
Size: 774 Bytes
Versions: 2
Compression:
Stored size: 774 Bytes
Contents
require 'spec_helper' describe MemoryModel::Base::Persistence do let(:model) do Class.new(MemoryModel::Base) do field :foo end end let(:value) { 'bar' } subject(:instance) { model.new(foo: value) } before(:each) do stub_const('MyModel', model) end describe '#persisted?' do it 'should be true if persisted' do instance.save instance.persisted?.should be_true end it 'should be false if not persisted' do instance.persisted?.should be_false end end describe '#new_record?' do it 'should be true unless persisted' do instance.save instance.new_record?.should be_false end it 'should be false unless not persisted' do instance.new_record?.should be_true end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
memory_model-1.0.0 | spec/memory_model/base/persistence_spec.rb |
memory_model-0.1.0 | spec/memory_model/base/persistence_spec.rb |