Sha256: 8509d968ca99613f984dec8fc4f7b82ec2182e9b4b869aa2260f0f9a73665b1b
Contents?: true
Size: 935 Bytes
Versions: 4
Compression:
Stored size: 935 Bytes
Contents
describe 'Yapper timestamps' do before do class Document include Yapper::Document include Yapper::Timestamps field :field_1 end end before { Yapper::DB.instance.purge } after { Object.send(:remove_const, 'Document') } describe 'when a document is created' do before { @document = Document.create(:field_1 => 'field_1') } it 'adds updated_at and created_at timestamps' do @document.created_at.should.be same_time_as(Time.now) @document.updated_at.should.be same_time_as(Time.now) end end describe 'when a document is updated' do before do @document = Document.create(:field_1 => '1') @created_at = @document.created_at @document.update_attributes(:field_1 => '2') end it 'only updates the updated_at field' do @document.created_at.should == @created_at @document.updated_at.should.be same_time_as(Time.now) end end end
Version data entries
4 entries across 4 versions & 1 rubygems