class PostgresqlTimestampFixtureTest
Public Instance Methods
test_bc_timestamp()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 75 def test_bc_timestamp date = Date.new(0) - 1.week Developer.create!(name: "aaron", updated_at: date) assert_equal date, Developer.find_by_name("aaron").updated_at end
test_bc_timestamp_leap_year()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 81 def test_bc_timestamp_leap_year date = Time.utc(-4, 2, 29) Developer.create!(name: "taihou", updated_at: date) assert_equal date, Developer.find_by_name("taihou").updated_at end
test_bc_timestamp_year_zero()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 87 def test_bc_timestamp_year_zero date = Time.utc(0, 4, 7) Developer.create!(name: "yahagi", updated_at: date) assert_equal date, Developer.find_by_name("yahagi").updated_at end
test_group_by_date()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 51 def test_group_by_date keys = Topic.group("date_trunc('month', created_at)").count.keys assert_operator keys.length, :>, 0 keys.each { |k| assert_kind_of Time, k } end
test_load_infinity_and_beyond()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 57 def test_load_infinity_and_beyond d = Developer.find_by_sql("select 'infinity'::timestamp as updated_at") assert d.first.updated_at.infinite?, "timestamp should be infinite" d = Developer.find_by_sql("select '-infinity'::timestamp as updated_at") time = d.first.updated_at assert time.infinite?, "timestamp should be infinite" assert_operator time, :<, 0 end
test_save_infinity_and_beyond()
click to toggle source
# File activerecord/test/cases/adapters/postgresql/timestamp_test.rb, line 67 def test_save_infinity_and_beyond d = Developer.create!(name: "aaron", updated_at: 1.0 / 0.0) assert_equal(1.0 / 0.0, d.updated_at) d = Developer.create!(name: "aaron", updated_at: -1.0 / 0.0) assert_equal(-1.0 / 0.0, d.updated_at) end