Sha256: dd8ec24032016e5bd51638b3718bd2a176a42e5757dad12dfdc920d3f5f5bbe8

Contents?: true

Size: 661 Bytes

Versions: 3

Compression:

Stored size: 661 Bytes

Contents

require 'spec_helper'

class TimeStampedModel
  include Id::Model
  include Id::Timestamps

  field :foo
  field :bar
end

module Id
  describe Timestamps do

    let(:model) { TimeStampedModel.new(:foo => 999, :bar => 666) }

    it 'should have a created_at date' do
      model.created_at.should be_a Time
    end

    it 'should update the updated at when set is called' do
      updated = model.set(:foo => 123)
      expect(updated.created_at).to be < updated.updated_at
    end

    it 'should update the updated at when unset is called' do
      updated = model.unset(:foo)
      expect(updated.created_at).to be < updated.updated_at
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
id-0.0.12 spec/lib/id/timestamps_spec.rb
id-0.0.11 spec/lib/id/timestamps_spec.rb
id-0.0.10 spec/lib/id/timestamps_spec.rb