diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-10-24 21:26:23 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-10-25 14:40:57 +0200 |
commit | abe91cb3bf1b408a23958e14a68077e56a5a3b84 (patch) | |
tree | 408ee61c067963bfdc5eecd61f693ffc17659e44 /activerecord/test/cases/yaml_serialization_test.rb | |
parent | 3e5bb8693ac8583e32f7080db62fb23a280205cf (diff) | |
download | rails-abe91cb3bf1b408a23958e14a68077e56a5a3b84.tar.gz rails-abe91cb3bf1b408a23958e14a68077e56a5a3b84.tar.bz2 rails-abe91cb3bf1b408a23958e14a68077e56a5a3b84.zip |
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 |