Sha256: e6c1a9e3592c09720dc083c11e506aa3dfa976d3bdd80de6bd2823f641825dd4

Contents?: true

Size: 636 Bytes

Versions: 205

Compression:

Stored size: 636 Bytes

Contents

require 'test_helper'

class CassandraObject::TimestampsTest < CassandraObject::TestCase
  test 'timestamps set on create' do
    issue = Issue.create

    assert_in_delta Time.now.to_i, issue.created_at.to_i, 3
    assert_in_delta Time.now.to_i, issue.updated_at.to_i, 3
  end

  test 'updated_at set on change' do
    issue = Issue.create

    issue.updated_at = nil
    issue.description = 'lol'
    issue.save

    assert_in_delta Time.now.to_i, issue.updated_at.to_i, 3
  end

  test 'created_at sets only if nil' do
    time = 5.days.ago
    issue = Issue.create created_at: time

    assert_equal time, issue.created_at
  end
end

Version data entries

205 entries across 205 versions & 2 rubygems

Version Path
gotime-cassandra_object-2.2.1 test/timestamps_test.rb
gotime-cassandra_object-2.2.0 test/timestamps_test.rb
gotime-cassandra_object-2.1.2 test/timestamps_test.rb
gotime-cassandra_object-2.1.1 test/timestamps_test.rb
gotime-cassandra_object-2.1.0 test/timestamps_test.rb