Sha256: fe1b7b6c5e636b28f9d0f015c33d2672ef8ecccb538d1866fc4fd4db8e8ac619

Contents?: true

Size: 627 Bytes

Versions: 10

Compression:

Stored size: 627 Bytes

Contents

require 'test_helper'

class Superstore::TimestampsTest < Superstore::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

10 entries across 10 versions & 1 rubygems

Version Path
superstore-1.0.10 test/unit/timestamps_test.rb
superstore-1.0.9 test/unit/timestamps_test.rb
superstore-1.0.8 test/unit/timestamps_test.rb
superstore-1.0.7 test/unit/timestamps_test.rb
superstore-1.0.6 test/unit/timestamps_test.rb
superstore-1.0.5 test/unit/timestamps_test.rb
superstore-1.0.4 test/unit/timestamps_test.rb
superstore-1.0.3 test/unit/timestamps_test.rb
superstore-1.0.2 test/unit/timestamps_test.rb
superstore-1.0.0 test/unit/timestamps_test.rb