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
sessionm-cassandra_object-4.0.13 test/timestamps_test.rb
sessionm-cassandra_object-4.0.12 test/timestamps_test.rb
sessionm-cassandra_object-4.0.11 test/timestamps_test.rb
sessionm-cassandra_object-4.0.10 test/timestamps_test.rb
sessionm-cassandra_object-4.0.9 test/timestamps_test.rb
sessionm-cassandra_object-2.7.3 test/timestamps_test.rb
sessionm-cassandra_object-2.7.2 test/timestamps_test.rb
sessionm-cassandra_object-4.0.8 test/timestamps_test.rb
sessionm-cassandra_object-4.0.7 test/timestamps_test.rb
sessionm-cassandra_object-4.0.6 test/timestamps_test.rb
sessionm-cassandra_object-4.0.5 test/timestamps_test.rb
sessionm-cassandra_object-4.0.4 test/timestamps_test.rb
sessionm-cassandra_object-4.0.3 test/timestamps_test.rb
sessionm-cassandra_object-4.0.2 test/timestamps_test.rb
sessionm-cassandra_object-4.0.1 test/timestamps_test.rb
sessionm-cassandra_object-4.0.0 test/timestamps_test.rb
sessionm-cassandra_object-2.7.1 test/timestamps_test.rb
sessionm-cassandra_object-2.7.0 test/timestamps_test.rb
sessionm-cassandra_object-2.6.1 test/timestamps_test.rb
sessionm-cassandra_object-2.6.0 test/timestamps_test.rb