diff options
author | Gilad Zohari <gzohari@gmail.com> | 2013-07-31 21:02:01 +0300 |
---|---|---|
committer | Gilad Zohari <gzohari@gmail.com> | 2013-08-01 00:27:25 +0300 |
commit | 3102a9aa4cfd747e116adc12dce6f5faf1453ea9 (patch) | |
tree | 241ba59b12fc66ad4ce1b2ddd3bba722c0cbcc94 /activesupport/test | |
parent | 742d1f2eda24dd411e018835680645d3921883f5 (diff) | |
download | rails-3102a9aa4cfd747e116adc12dce6f5faf1453ea9.tar.gz rails-3102a9aa4cfd747e116adc12dce6f5faf1453ea9.tar.bz2 rails-3102a9aa4cfd747e116adc12dce6f5faf1453ea9.zip |
Refactor Date, Time, DateTime timezone methods
Similar implementations of #in_time_zone exists for Date, Time and DateTime so
method is extracted into its own module. Also some logic is extracted into
private method.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/time_with_zone_test.rb | 8 |
1 files changed, 8 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 fab3d8ac38..baac9e07ce 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -997,6 +997,14 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < ActiveSupport::TestCase Time.zone = nil end + def test_time_in_time_zone_doesnt_affect_receiver + with_env_tz 'Europe/London' do + time = Time.local(2000, 7, 1) + time_with_zone = time.in_time_zone('Eastern Time (US & Canada)') + assert_not time.utc?, 'time expected to be local, but is UTC' + end + end + protected def with_env_tz(new_tz = 'US/Eastern') old_tz, ENV['TZ'] = ENV['TZ'], new_tz |