aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-28 17:30:17 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-28 17:30:17 +0000
commit60de8c110829cb7f2df1d312ad2898633e896c24 (patch)
treecc6fafcc057c94bbda035f3277324a24368a418c /activerecord/test
parent8a9b998b7960ba171d77cc11bb4f4c318a05ac46 (diff)
downloadrails-60de8c110829cb7f2df1d312ad2898633e896c24.tar.gz
rails-60de8c110829cb7f2df1d312ad2898633e896c24.tar.bz2
rails-60de8c110829cb7f2df1d312ad2898633e896c24.zip
Added Base.default_timezone accessor that determines whether to use Time.local (using :local) or Time.utc (using :utc) when pulling dates and times from the database. This is set to :local by default.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@271 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/base_test.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index c2a105f85d..8bbf98555d 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -327,7 +327,16 @@ class BasicsTest < Test::Unit::TestCase
assert_equal 1, topic.approved
assert_nil topic.last_read
end
-
+
+ def test_utc_as_time_zone
+ Topic.default_timezone = :utc
+ attributes = { "bonus_time" => "5:42:00AM" }
+ topic = Topic.find(1)
+ topic.attributes = attributes
+ assert_equal Time.utc(2000, 1, 1, 5, 42, 0), topic.bonus_time
+ Topic.default_timezone = :local
+ end
+
def test_default_values_on_empty_strings
topic = Topic.new
topic.approved = nil