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-4.0.1 test/unit/timestamps_test.rb
gotime-cassandra_object-4.0.0 test/unit/timestamps_test.rb
sessionm-cassandra_object-2.2.55 test/timestamps_test.rb
gotime-cassandra_object-3.0.5 test/unit/timestamps_test.rb
gotime-cassandra_object-3.0.4 test/unit/timestamps_test.rb
gotime-cassandra_object-3.0.3 test/unit/timestamps_test.rb
gotime-cassandra_object-3.0.2 test/unit/timestamps_test.rb
gotime-cassandra_object-3.0.1 test/unit/timestamps_test.rb
gotime-cassandra_object-3.0.0 test/unit/timestamps_test.rb
gotime-cassandra_object-2.13.0 test/unit/timestamps_test.rb
gotime-cassandra_object-2.12.5 test/unit/timestamps_test.rb
sessionm-cassandra_object-2.2.54 test/timestamps_test.rb
sessionm-cassandra_object-2.2.53 test/timestamps_test.rb
sessionm-cassandra_object-2.2.52 test/timestamps_test.rb
gotime-cassandra_object-2.12.4 test/unit/timestamps_test.rb
gotime-cassandra_object-2.12.3 test/unit/timestamps_test.rb
gotime-cassandra_object-2.12.2 test/unit/timestamps_test.rb
gotime-cassandra_object-2.12.1 test/unit/timestamps_test.rb
sessionm-cassandra_object-2.2.51 test/timestamps_test.rb
sessionm-cassandra_object-2.2.50 test/timestamps_test.rb