Sha256: 9d75c90a336fdb98d45ee8d28d0277703312029f2143d2b2ae7eb27dccb4bdbc

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

require "spec_helper"

describe Mongoid::Timestamps do

  describe ".included" do

    before do
      @person = Person.new
    end

    it "adds created_at and modified_at to the document" do
      fields = Person.instance_variable_get(:@fields)
      fields[:created_at].should_not be_nil
      fields[:modified_at].should_not be_nil
    end

    it "forces the timestamps to UTC" do
      @person.run_callbacks(:before_save)
      @person.created_at.should be_close(Time.now.utc, 10.seconds)
      @person.modified_at.should be_close(Time.now.utc, 10.seconds)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-0.9.4 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.9.3 spec/unit/mongoid/timestamps_spec.rb