Sha256: 8862538412d8e4c585158331245353dc85a7b9367e3da37eb065700db11bba3d
Contents?: true
Size: 837 Bytes
Versions: 17
Compression:
Stored size: 837 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Pupa::Concerns::Timestamps do let :klass do Class.new do include Pupa::Model include Pupa::Concerns::Timestamps def save run_callbacks(:save) do unless created_at run_callbacks(:create) do end end end end end end it 'should set created_at and updated_at on create' do object = klass.new object.save object.created_at.should be_within(1).of(Time.now.utc) object.updated_at.should be_within(1).of(Time.now.utc) end it 'should set updated_at on save' do object = klass.new(created_at: Time.new(2000)) object.save object.created_at.should == Time.new(2000) object.updated_at.should be_within(1).of(Time.now.utc) end end
Version data entries
17 entries across 17 versions & 1 rubygems