Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8326

Show
Ignore:
Timestamp:
12/07/07 03:00:50 (10 months ago)
Author:
gbuesing
Message:

Anchor DateTimeTest to fixed DateTime instead of a variable value based on Time.now#advance#to_datetime. Works around issue on 64-bit platforms with Ruby's Time#to_datetime respecting fractional seconds, and database adapters not respecting them for DateTimes, throwing off before-and-after-save equality test. References #10080, #10073

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r8325 r8326  
    11*2.0.0* (December 6th, 2007) 
     2 
     3* Anchor DateTimeTest to fixed DateTime instead of a variable value based on Time.now#advance#to_datetime, so that this test passes on 64-bit platforms running Ruby 1.8.6+ [Geoff Buesing] 
    24 
    35* Fixed that the Query Cache should just be ignored if the database is misconfigured (so that the "About your applications environment" works even before the database has been created) [DHH] 
  • trunk/activerecord/test/date_time_test.rb

    r7556 r8326  
    55class DateTimeTest < Test::Unit::TestCase 
    66  def test_saves_both_date_and_time 
    7     now = 200.years.ago.to_datetime 
     7    time_values = [1807, 2, 10, 15, 30, 45] 
     8    now = DateTime.civil(*time_values) 
    89 
    910    task = Task.new 
    1011    task.starting = now 
    1112    task.save! 
    12  
    13     assert_equal now, Task.find(task.id).starting.to_datetime 
     13     
     14    # check against Time.local_time, since some platforms will return a Time instead of a DateTime 
     15    assert_equal Time.local_time(*time_values), Task.find(task.id).starting 
    1416  end 
    1517