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/serialized_attribute_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/serialized_attribute_test.rb')
-rw-r--r-- | activerecord/test/cases/serialized_attribute_test.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb index 7fe065ee88..bc67da8d27 100644 --- a/activerecord/test/cases/serialized_attribute_test.rb +++ b/activerecord/test/cases/serialized_attribute_test.rb @@ -211,16 +211,15 @@ class SerializedAttributeTest < ActiveRecord::TestCase end def test_serialize_attribute_via_select_method_when_time_zone_available - ActiveRecord::Base.time_zone_aware_attributes = true - Topic.serialize(:content, MyObject) + with_timezone_config aware_attributes: true do + Topic.serialize(:content, MyObject) - myobj = MyObject.new('value1', 'value2') - topic = Topic.create(content: myobj) + myobj = MyObject.new('value1', 'value2') + topic = Topic.create(content: myobj) - assert_equal(myobj, Topic.select(:content).find(topic.id).content) - assert_raise(ActiveModel::MissingAttributeError) { Topic.select(:id).find(topic.id).content } - ensure - ActiveRecord::Base.time_zone_aware_attributes = false + assert_equal(myobj, Topic.select(:content).find(topic.id).content) + assert_raise(ActiveModel::MissingAttributeError) { Topic.select(:id).find(topic.id).content } + end end def test_serialize_attribute_can_be_serialized_in_an_integer_column |