public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
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

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8326 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
gbuesing (author)
Thu Dec 06 19:00:50 -0800 2007
commit  2766f7629f318f0f7dadf2286113504113fef562
tree    29d0a1fa41ef23ed492f86aff2b54cdc79464451
parent  731ecec15ee306049bc33af6966f877ad4f67d27
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *2.0.0* (December 6th, 2007)
0
 
0
+* 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]
0
+
0
 * 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]
0
 
0
 * Fixed that the truncation of strings longer than 50 chars should use inspect so newlines etc are escaped #10385 [norbert]
...
4
5
6
7
 
 
8
9
10
11
12
13
 
 
 
14
15
16
...
4
5
6
 
7
8
9
10
11
12
 
 
13
14
15
16
17
18
0
@@ -4,13 +4,15 @@
0
 
0
 class DateTimeTest < Test::Unit::TestCase
0
   def test_saves_both_date_and_time
0
- now = 200.years.ago.to_datetime
0
+ time_values = [1807, 2, 10, 15, 30, 45]
0
+ now = DateTime.civil(*time_values)
0
 
0
     task = Task.new
0
     task.starting = now
0
     task.save!
0
-
0
- assert_equal now, Task.find(task.id).starting.to_datetime
0
+
0
+ # check against Time.local_time, since some platforms will return a Time instead of a DateTime
0
+ assert_equal Time.local_time(*time_values), Task.find(task.id).starting
0
   end
0
 
0
   def test_assign_empty_date_time

Comments

    No one has commented yet.