aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/time_ext_test.rb
diff options
context:
space:
mode:
authorZuhao Wan <wanzuhao@gmail.com>2014-06-18 19:46:04 +0800
committerZuhao Wan <wanzuhao@gmail.com>2014-06-18 19:46:04 +0800
commit9c492885d178b1a3d0de2f710a8a276db3d867b2 (patch)
tree1bcf8d640a8d302e1df5a56587f0f7e58b3922c6 /activesupport/test/core_ext/time_ext_test.rb
parente2f232aba15937a4b9d14bd91e0392c6d55be58d (diff)
downloadrails-9c492885d178b1a3d0de2f710a8a276db3d867b2.tar.gz
rails-9c492885d178b1a3d0de2f710a8a276db3d867b2.tar.bz2
rails-9c492885d178b1a3d0de2f710a8a276db3d867b2.zip
Extract out with_env_tz helper method.
It’s used at so many places that extracting it out into a helper file is worth doing.
Diffstat (limited to 'activesupport/test/core_ext/time_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index e0a4b1be3e..c8283cddc5 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -1,6 +1,7 @@
require 'abstract_unit'
require 'active_support/time'
require 'core_ext/date_and_time_behavior'
+require 'time_zone_test_helpers'
class TimeExtCalculationsTest < ActiveSupport::TestCase
def date_time_init(year,month,day,hour,minute,second,usec=0)
@@ -8,6 +9,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
end
include DateAndTimeBehavior
+ include TimeZoneTestHelpers
def test_seconds_since_midnight
assert_equal 1,Time.local(2005,1,1,0,0,1).seconds_since_midnight
@@ -847,15 +849,6 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
def test_all_year
assert_equal Time.local(2011,1,1,0,0,0)..Time.local(2011,12,31,23,59,59,Rational(999999999, 1000)), Time.local(2011,6,7,10,10,10).all_year
end
-
- protected
- def with_env_tz(new_tz = 'US/Eastern')
- old_tz, ENV['TZ'] = ENV['TZ'], new_tz
- yield
- ensure
- old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ')
- end
-
end
class TimeExtMarshalingTest < ActiveSupport::TestCase