Permalink
Browse files

Oracle adapter returns Time value for DATE columns

  • Loading branch information...
1 parent 42fd2a3 commit 3a1cbc5c3b3bcb2de4be6e4469bb87b99759dc59 @rsim rsim committed Mar 22, 2009
Showing with 12 additions and 2 deletions.
  1. +12 −2 activerecord/test/cases/invalid_date_test.rb
@@ -11,13 +11,23 @@ def test_assign_valid_dates
valid_dates.each do |date_src|
topic = Topic.new("last_read(1i)" => date_src[0].to_s, "last_read(2i)" => date_src[1].to_s, "last_read(3i)" => date_src[2].to_s)
- assert_equal(topic.last_read, Date.new(*date_src))
+ # Oracle DATE columns are datetime columns and Oracle adapter returns Time value
+ if current_adapter?(:OracleAdapter)
+ assert_equal(topic.last_read.to_date, Date.new(*date_src))
+ else
+ assert_equal(topic.last_read, Date.new(*date_src))
+ end
end
invalid_dates.each do |date_src|
assert_nothing_raised do
topic = Topic.new({"last_read(1i)" => date_src[0].to_s, "last_read(2i)" => date_src[1].to_s, "last_read(3i)" => date_src[2].to_s})
- assert_equal(topic.last_read, Time.local(*date_src).to_date, "The date should be modified according to the behaviour of the Time object")
+ # Oracle DATE columns are datetime columns and Oracle adapter returns Time value
+ if current_adapter?(:OracleAdapter)
+ assert_equal(topic.last_read.to_date, Time.local(*date_src).to_date, "The date should be modified according to the behaviour of the Time object")
+ else
+ assert_equal(topic.last_read, Time.local(*date_src).to_date, "The date should be modified according to the behaviour of the Time object")
+ end
end
end
end

0 comments on commit 3a1cbc5

Please sign in to comment.