aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-06-17 14:10:51 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2010-06-17 14:14:30 -0700
commit5ae7a9d31d6222b265013ab450f9d30b88113e69 (patch)
tree2e448230f3d8eb583a10d90075221ea449a9ae1f /activesupport/test/core_ext
parent84d387bc0f3f3f6641b08d0ce40e924f09105c19 (diff)
downloadrails-5ae7a9d31d6222b265013ab450f9d30b88113e69.tar.gz
rails-5ae7a9d31d6222b265013ab450f9d30b88113e69.tar.bz2
rails-5ae7a9d31d6222b265013ab450f9d30b88113e69.zip
when the timezone is nil, a TimeWithZone object should not be constructed. [#4881 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index 2cf5bd6ea9..cf11f4d28f 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -737,6 +737,13 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < Test::Unit::TestCase
end
end
+ def test_nil_time_zone
+ Time.use_zone nil do
+ assert !@t.in_time_zone.respond_to?(:period), 'no period method'
+ assert !@dt.in_time_zone.respond_to?(:period), 'no period method'
+ end
+ end
+
def test_in_time_zone_with_argument
Time.use_zone 'Eastern Time (US & Canada)' do # Time.zone will not affect #in_time_zone(zone)
assert_equal 'Fri, 31 Dec 1999 15:00:00 AKST -09:00', @t.in_time_zone('Alaska').inspect