diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-10-25 06:10:11 -0700 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-10-25 06:10:11 -0700 |
commit | 2dc579baf4045fc6bcc38a2fe00d5fd19431201f (patch) | |
tree | 677910129b09dbf604993c5d4ec2834fd73d0d98 /activerecord/test/cases/yaml_serialization_test.rb | |
parent | 3c3ffac0117a9a3ce4de1f84a7a3eb7a35d016a8 (diff) | |
parent | abe91cb3bf1b408a23958e14a68077e56a5a3b84 (diff) | |
download | rails-2dc579baf4045fc6bcc38a2fe00d5fd19431201f.tar.gz rails-2dc579baf4045fc6bcc38a2fe00d5fd19431201f.tar.bz2 rails-2dc579baf4045fc6bcc38a2fe00d5fd19431201f.zip |
Merge pull request #12633 from senny/no_more_time_zone_leaks
prevent global timezone state from leaking out of test cases.
Diffstat (limited to 'activerecord/test/cases/yaml_serialization_test.rb')
-rw-r--r-- | activerecord/test/cases/yaml_serialization_test.rb | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/activerecord/test/cases/yaml_serialization_test.rb b/activerecord/test/cases/yaml_serialization_test.rb index 302913e095..83a710b1b7 100644 --- a/activerecord/test/cases/yaml_serialization_test.rb +++ b/activerecord/test/cases/yaml_serialization_test.rb @@ -5,16 +5,10 @@ class YamlSerializationTest < ActiveRecord::TestCase fixtures :topics def test_to_yaml_with_time_with_zone_should_not_raise_exception - tz = Time.zone - Time.zone = ActiveSupport::TimeZone["Pacific Time (US & Canada)"] - ActiveRecord::Base.time_zone_aware_attributes = true - - topic = Topic.new(:written_on => DateTime.now) - assert_nothing_raised { topic.to_yaml } - - ensure - Time.zone = tz - ActiveRecord::Base.time_zone_aware_attributes = false + with_timezone_config aware_attributes: true, zone: "Pacific Time (US & Canada)" do + topic = Topic.new(:written_on => DateTime.now) + assert_nothing_raised { topic.to_yaml } + end end def test_roundtrip |