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.32 test/timestamps_test.rb
sessionm-cassandra_object-4.0.31 test/timestamps_test.rb
sessionm-cassandra_object-4.0.30 test/timestamps_test.rb
sessionm-cassandra_object-4.0.29 test/timestamps_test.rb
sessionm-cassandra_object-4.0.28 test/timestamps_test.rb
sessionm-cassandra_object-4.0.27 test/timestamps_test.rb
sessionm-cassandra_object-4.0.26 test/timestamps_test.rb
sessionm-cassandra_object-4.0.25 test/timestamps_test.rb
sessionm-cassandra_object-4.0.24 test/timestamps_test.rb
sessionm-cassandra_object-4.0.23 test/timestamps_test.rb
sessionm-cassandra_object-4.0.22 test/timestamps_test.rb
sessionm-cassandra_object-4.0.21 test/timestamps_test.rb
sessionm-cassandra_object-4.0.20 test/timestamps_test.rb
sessionm-cassandra_object-2.7.5 test/timestamps_test.rb
sessionm-cassandra_object-2.7.4 test/timestamps_test.rb
sessionm-cassandra_object-4.0.18 test/timestamps_test.rb
sessionm-cassandra_object-4.0.17 test/timestamps_test.rb
sessionm-cassandra_object-4.0.16 test/timestamps_test.rb
sessionm-cassandra_object-4.0.15 test/timestamps_test.rb
sessionm-cassandra_object-4.0.14 test/timestamps_test.rb