aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/json
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/json
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/json')
-rw-r--r--activesupport/test/json/encoding_test.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index f22d7b8b02..b4cf37b177 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -4,8 +4,11 @@ require 'abstract_unit'
require 'active_support/core_ext/string/inflections'
require 'active_support/json'
require 'active_support/time'
+require 'time_zone_test_helpers'
class TestJSONEncoding < ActiveSupport::TestCase
+ include TimeZoneTestHelpers
+
class Foo
def initialize(a, b)
@a, @b = a, b
@@ -530,13 +533,6 @@ EXPECTED
json_object[1..-2].scan(/([^{}:,\s]+):/).flatten.sort
end
- 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
-
def with_standard_json_time_format(boolean = true)
old, ActiveSupport.use_standard_json_time_format = ActiveSupport.use_standard_json_time_format, boolean
yield