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.9.1 test/unit/timestamps_test.rb
gotime-cassandra_object-2.9.0 test/unit/timestamps_test.rb
sessionm-cassandra_object-2.2.33 test/timestamps_test.rb
gotime-cassandra_object-2.8.6 test/unit/timestamps_test.rb
sessionm-cassandra_object-2.2.32 test/timestamps_test.rb
gotime-cassandra_object-2.8.5 test/unit/timestamps_test.rb
gotime-cassandra_object-2.8.4 test/timestamps_test.rb
sessionm-cassandra_object-2.2.31 test/timestamps_test.rb
gotime-cassandra_object-2.8.3 test/timestamps_test.rb
sessionm-cassandra_object-2.2.30 test/timestamps_test.rb
gotime-cassandra_object-2.8.2 test/timestamps_test.rb
gotime-cassandra_object-2.8.1 test/timestamps_test.rb
sessionm-cassandra_object-2.2.29 test/timestamps_test.rb
gotime-cassandra_object-2.8.0 test/timestamps_test.rb
gotime-cassandra_object-2.7.12 test/timestamps_test.rb
gotime-cassandra_object-2.7.11 test/timestamps_test.rb
sessionm-cassandra_object-2.2.28 test/timestamps_test.rb
gotime-cassandra_object-2.7.10 test/timestamps_test.rb
gotime-cassandra_object-2.7.9 test/timestamps_test.rb
sessionm-cassandra_object-2.2.27 test/timestamps_test.rb