aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2019-01-14 01:40:56 -0500
committerLibravatarUnit 193 <unit193@ubuntu.com>2019-01-14 01:40:56 -0500
commitdddfa903d2b856146f05ffb4415c31d6127bb5bf (patch)
treee38c2aca92b54f06ccd0185f48dc47e3e1b3d77e /test/test_helper.rb
parent8280a21a23d44aa90177e2bc041d0b8dc8556f4b (diff)
New upstream version 2.8.0upstream/2.8.0
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 96af546..9b761af 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -154,3 +154,16 @@ def skip_jruby_incompatible_test
msg = "This test uses a feature incompatible with JRuby"
skip(msg) if defined?(JRUBY_VERSION)
end
+
+def with_timezone(new_tz)
+ if new_tz
+ begin
+ prev_tz, ENV['TZ'] = ENV['TZ'], new_tz
+ yield
+ ensure
+ ENV['TZ'] = prev_tz
+ end
+ else
+ yield
+ end
+end