Sha256: 1b849347b5ab3851700a644a9c78c4f0ce2a5d2a745478091ed97f928e801a3b

Contents?: true

Size: 646 Bytes

Versions: 19

Compression:

Stored size: 646 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "/../../spec_helper.rb"))

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

19 entries across 19 versions & 1 rubygems

Version Path
mongoid-0.8.2 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.8.1 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.10 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.9 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.8 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.7 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.6 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.5 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.4 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.3 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.2 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.1 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.7.0 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.6.10 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.6.9 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.6.8 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.6.7 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.6.6 spec/unit/mongoid/timestamps_spec.rb
mongoid-0.6.5 spec/unit/mongoid/timestamps_spec.rb