aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorGeoff Buesing <gbuesing@gmail.com>2007-12-07 03:00:50 +0000
committerGeoff Buesing <gbuesing@gmail.com>2007-12-07 03:00:50 +0000
commit2766f7629f318f0f7dadf2286113504113fef562 (patch)
tree29d0a1fa41ef23ed492f86aff2b54cdc79464451 /activerecord
parent731ecec15ee306049bc33af6966f877ad4f67d27 (diff)
downloadrails-2766f7629f318f0f7dadf2286113504113fef562.tar.gz
rails-2766f7629f318f0f7dadf2286113504113fef562.tar.bz2
rails-2766f7629f318f0f7dadf2286113504113fef562.zip
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
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activerecord/test/date_time_test.rb8
2 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 277adb934b..6e6cec03ae 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*2.0.0* (December 6th, 2007)
+* 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]
+
* 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]
* Fixed that the truncation of strings longer than 50 chars should use inspect so newlines etc are escaped #10385 [norbert]
diff --git a/activerecord/test/date_time_test.rb b/activerecord/test/date_time_test.rb
index 8a5ed8c40b..3bd44fd47b 100644
--- a/activerecord/test/date_time_test.rb
+++ b/activerecord/test/date_time_test.rb
@@ -4,13 +4,15 @@ require 'fixtures/task'
class DateTimeTest < Test::Unit::TestCase
def test_saves_both_date_and_time
- now = 200.years.ago.to_datetime
+ time_values = [1807, 2, 10, 15, 30, 45]
+ now = DateTime.civil(*time_values)
task = Task.new
task.starting = now
task.save!
-
- assert_equal now, Task.find(task.id).starting.to_datetime
+
+ # check against Time.local_time, since some platforms will return a Time instead of a DateTime
+ assert_equal Time.local_time(*time_values), Task.find(task.id).starting
end
def test_assign_empty_date_time