Sha256: 3c507aea591660bc0ed5559fe7447bbcb7d4cb2a5c03cb603959220a5e7d33e5

Contents?: true

Size: 619 Bytes

Versions: 12

Compression:

Stored size: 619 Bytes

Contents

# encoding: UTF-8

require File.expand_path("./helper", File.dirname(__FILE__))

class Person < Ohm::Model
  include Ohm::Timestamps
end

test "a new? record" do
  assert nil == Person.new.created_at
  assert nil == Person.new.updated_at
end

test "on create" do
  person = Person.create
  person = Person[person.id]

  assert NOW == person.created_at
  assert NOW == person.updated_at
end

test "on update" do
  person = Person.create

  override(Time, :now => Time.utc(2010, 5, 13))
  person.save
  person = Person[person.id]

  assert NOW == person.created_at
  assert Time.utc(2010, 5, 13) == person.updated_at
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ohm-contrib-2.0.0.alpha5 test/timestamp.rb
ohm-contrib-2.0.0.alpha4 test/timestamp.rb
ohm-contrib-2.0.0.alpha3 test/timestamp.rb
ohm-contrib-2.0.0.alpha2 test/timestamp.rb
ohm-contrib-1.2 test/timestamp.rb
ohm-contrib-1.1.0 test/timestamp.rb
ohm-contrib-1.0.1 test/timestamp.rb
ohm-contrib-1.0.0 test/timestamp.rb
ohm-contrib-1.0.0.rc5 test/timestamp.rb
ohm-contrib-1.0.0.rc4 test/timestamp.rb
ohm-contrib-1.0.0.rc3 test/timestamp.rb
ohm-contrib-1.0.0.rc2 test/timestamp.rb