diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2008-02-10 22:46:31 +0000 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2008-02-10 22:46:31 +0000 |
commit | c9402b2277b18e65064720cc9ebf272a321de1ff (patch) | |
tree | b65600cf4405d49522e54f0fac688614db8da13c /activerecord/test/cases | |
parent | 6608a3ef37a8f998958b867a1be186d33edbc151 (diff) | |
download | rails-c9402b2277b18e65064720cc9ebf272a321de1ff.tar.gz rails-c9402b2277b18e65064720cc9ebf272a321de1ff.tar.bz2 rails-c9402b2277b18e65064720cc9ebf272a321de1ff.zip |
Multiparameter attributes for time columns fail over to DateTime when out of range of Time
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8855 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/cases')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 93a40267fc..e98a756870 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -923,6 +923,17 @@ class BasicsTest < ActiveRecord::TestCase topic.attributes = attributes assert_equal Time.local(2004, 6, 24, 16, 24, 0), topic.written_on end + + def test_multiparameter_attributes_on_time_with_old_date + attributes = { + "written_on(1i)" => "1850", "written_on(2i)" => "6", "written_on(3i)" => "24", + "written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => "00" + } + topic = Topic.find(1) + topic.attributes = attributes + # testing against to_s(:db) representation because either a Time or a DateTime might be returned, depending on platform + assert_equal "1850-06-24 16:24:00", topic.written_on.to_s(:db) + end def test_multiparameter_attributes_on_time_with_utc ActiveRecord::Base.default_timezone = :utc |