aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-08-05 20:50:26 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-08-05 20:50:26 +0000
commitc99df461f45c514d434a6f0bcb368320b71fd0c8 (patch)
tree92fb1035099cdb40281800070b4aa8ba6ecb3e19 /activerecord/test
parent5130fc84c602001d31454a5631ee7b354d197663 (diff)
downloadrails-c99df461f45c514d434a6f0bcb368320b71fd0c8.tar.gz
rails-c99df461f45c514d434a6f0bcb368320b71fd0c8.tar.bz2
rails-c99df461f45c514d434a6f0bcb368320b71fd0c8.zip
Fixed that default timezones for new / initialize should uphold utc setting (closes #5709) [daniluk@yahoo.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4670 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/base_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index d3f2840291..9518e0aca8 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -560,6 +560,22 @@ class BasicsTest < Test::Unit::TestCase
Topic.default_timezone = :local
end
+ def test_utc_as_time_zone_and_new
+ # Oracle and SQLServer do not have a TIME datatype.
+ return true if current_adapter?(:SQLServerAdapter, :OracleAdapter)
+
+ Topic.default_timezone = :utc
+ attributes = { "bonus_time(1i)"=>"2000",
+ "bonus_time(2i)"=>"1",
+ "bonus_time(3i)"=>"1",
+ "bonus_time(4i)"=>"10",
+ "bonus_time(5i)"=>"35",
+ "bonus_time(6i)"=>"50" }
+ topic = Topic.new(attributes)
+ assert_equal Time.utc(2000, 1, 1, 10, 35, 50), topic.bonus_time
+ Topic.default_timezone = :local
+ end
+
def test_default_values_on_empty_strings
topic = Topic.new
topic.approved = nil