diff options
author | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2010-07-15 04:40:17 +0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-19 23:44:49 +0800 |
commit | 7637b7184a990ae51f3ab10e2af99ff88cb633ea (patch) | |
tree | 80305c59424809f6e7fe683c6a53c62d04890cff | |
parent | 010eda2eb516d237a7b5cf022b7dd2213ff77bc3 (diff) | |
download | rails-7637b7184a990ae51f3ab10e2af99ff88cb633ea.tar.gz rails-7637b7184a990ae51f3ab10e2af99ff88cb633ea.tar.bz2 rails-7637b7184a990ae51f3ab10e2af99ff88cb633ea.zip |
Test for behaviour of befeore_type_cast when operating on datetime colmun
-rw-r--r-- | activerecord/test/cases/base_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 709e22a648..df6895f0d0 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -123,6 +123,14 @@ class BasicsTest < ActiveRecord::TestCase assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"] else assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"].to_s(:db) + + developer.created_at = "345643456" + assert_equal developer.created_at_before_type_cast, "345643456" + assert_equal developer.created_at, nil + + developer.created_at = "2010-03-21T21:23:32+01:00" + assert_equal developer.created_at_before_type_cast, "2010-03-21T21:23:32+01:00" + assert_equal developer.created_at, Time.parse("2010-03-21T21:23:32+01:00") end end |