aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_ext_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-02-06 06:43:02 +0000
committerRick Olson <technoweenie@gmail.com>2008-02-06 06:43:02 +0000
commit72385a7be65bb27b07cd2ee3bc9fe221d8e04f90 (patch)
tree24e89ad3c45c6bcd41ddaa0f02d8e4918c28d51d /activesupport/test/core_ext/time_ext_test.rb
parent692dbbf79387b56e241e1acd05f74f7d71ff79a6 (diff)
downloadrails-72385a7be65bb27b07cd2ee3bc9fe221d8e04f90.tar.gz
rails-72385a7be65bb27b07cd2ee3bc9fe221d8e04f90.tar.bz2
rails-72385a7be65bb27b07cd2ee3bc9fe221d8e04f90.zip
Add Time Zone support to ActiveRecord, and config.time_zone property for specifying a default Time Zone. Closes #10982 [Geoff Buesing, rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8806 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 37fd6f027b..40e8c5ecfd 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -459,6 +459,15 @@ class TimeExtCalculationsTest < Test::Unit::TestCase
assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), TimeZone['UTC'] )
end
+ def test_time_created_with_local_constructor_cannot_represent_times_during_hour_skipped_by_dst
+ with_env_tz 'US/Eastern' do
+ # On Apr 2 2006 at 2:00AM in US, clocks were moved forward to 3:00AM.
+ # Therefore, 2AM EST doesn't exist for this date; Time.local fails over to 3:00AM EDT
+ assert_equal Time.local(2006, 4, 2, 3), Time.local(2006, 4, 2, 2)
+ assert Time.local(2006, 4, 2, 2).dst?
+ end
+ end
+
protected
def with_env_tz(new_tz = 'US/Eastern')
old_tz, ENV['TZ'] = ENV['TZ'], new_tz