Permalink
Browse files

Test for behaviour of befeore_type_cast when operating on datetime co…

…lmun
  • Loading branch information...
1 parent 010eda2 commit 7637b7184a990ae51f3ab10e2af99ff88cb633ea @lukaszx0 lukaszx0 committed with tenderlove Jul 14, 2010
Showing with 8 additions and 0 deletions.
  1. +8 −0 activerecord/test/cases/base_test.rb
@@ -123,6 +123,14 @@ def test_read_attributes_before_type_cast_on_datetime
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

0 comments on commit 7637b71

Please sign in to comment.