aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-05-30 07:58:00 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-05-30 07:58:00 +0900
commit966715d52811578f5fbbe63e2c5c441971f91b6f (patch)
tree558156119e317562c652044a814e75d7bc9d775e
parente1758b5e8c8d49fdf931b0b3f8009810880113a6 (diff)
downloadrails-966715d52811578f5fbbe63e2c5c441971f91b6f.tar.gz
rails-966715d52811578f5fbbe63e2c5c441971f91b6f.tar.bz2
rails-966715d52811578f5fbbe63e2c5c441971f91b6f.zip
Reset time zone to previous value
Since `CurrentAttributesTest` changed the global time zone, it is necessary to restore the original value after changing the test. The reproduction step: ``` ./bin/test -w --seed 5549 test/current_attributes_test.rb test/core_ext/date_ext_test.rb ```
-rw-r--r--activesupport/test/current_attributes_test.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/activesupport/test/current_attributes_test.rb b/activesupport/test/current_attributes_test.rb
index 67ef6ef619..a1f3b33444 100644
--- a/activesupport/test/current_attributes_test.rb
+++ b/activesupport/test/current_attributes_test.rb
@@ -28,7 +28,14 @@ class CurrentAttributesTest < ActiveSupport::TestCase
end
end
- setup { Current.reset }
+ setup do
+ @original_time_zone = Time.zone
+ Current.reset
+ end
+
+ teardown do
+ Time.zone = @original_time_zone
+ end
test "read and write attribute" do
Current.world = "world/1"