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

Ticket #10073 (new defect)

Opened 1 year ago

Last modified 1 year ago

[PATCH] Fixes failure of datetime test for SQL Server

Reported by: lawrence Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveRecord Version: edge
Severity: normal Keywords: patch test sqlserver
Cc:

Description

The test test_saves_both_date_and_time fails for SQL Server. This patch fixes this.

SQLServer can't handle dates 200 years ago. 50 years ago is fine.


Note though when you change the first line of the test from 50.years.ago to e.g. 30.years.ago the test fails for all databases. Strangely enough the failure message says the actual result and the expected result are the same. Upon closer inspection I note that both the actual and the expected result are both of class DateTime, so I don't know what's going there. Anything that would result in a date on or after 1970 results in this test failure. Perhaps we should this test for a date after 1970 as well, and fix whatever the issue is.

  1) Failure:
test_saves_both_date_and_time(DateTimeTest) [test/date_time_test.rb:13]:
<Thu, 05 Nov 1987 19:09:39 +1100> expected but was
<Thu, 05 Nov 1987 19:09:39 +1100>.

Attachments

test_datetime.patch (446 bytes) - added by lawrence on 11/05/07 10:05:12.
sqlserver_test_datetime.patch (0.7 kB) - added by lawrence on 11/05/07 10:08:54.

Change History

11/05/07 10:05:12 changed by lawrence

  • attachment test_datetime.patch added.

11/05/07 10:08:54 changed by lawrence

  • attachment sqlserver_test_datetime.patch added.

11/05/07 20:09:30 changed by lawrence

(In [8074]) Fixes failure of datetime test for SQL Server. References #10073

11/06/07 20:16:36 changed by lawrence

Re extra comment: that is now handled by #10080

11/29/07 23:27:51 changed by lawrence

(In [8242]) Reverses changeset 8074 because it may cause a coredump in ADO.rb. References #10073.

12/07/07 03:00:53 changed by gbuesing

(In [8326]) 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