aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_helper.rb
diff options
context:
space:
mode:
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