aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-09-17 12:37:00 -0600
committerSean Griffin <sean@thoughtbot.com>2014-09-17 12:37:00 -0600
commitfab487228c880c3b85b06de1770679d45f7a7dfa (patch)
tree73db99c1becf63a3af88f246a5668ea09278477c /activerecord/test/cases/attribute_methods_test.rb
parent8c6c1dd82eec0f2e358146ffff7b6adfbb530d5f (diff)
downloadrails-fab487228c880c3b85b06de1770679d45f7a7dfa.tar.gz
rails-fab487228c880c3b85b06de1770679d45f7a7dfa.tar.bz2
rails-fab487228c880c3b85b06de1770679d45f7a7dfa.zip
Allow YAML serialization when using TZ aware attributes
Diffstat (limited to 'activerecord/test/cases/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index b4917e727a..153f870e3d 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -681,6 +681,14 @@ class AttributeMethodsTest < ActiveRecord::TestCase
end
end
+ def test_yaml_dumping_record_with_time_zone_aware_attribute
+ in_time_zone "Pacific Time (US & Canada)" do
+ record = Topic.new(id: 1)
+ record.written_on = "Jan 01 00:00:00 2014"
+ assert_equal record, YAML.load(YAML.dump(record))
+ end
+ end
+
def test_setting_time_zone_conversion_for_attributes_should_write_value_on_class_variable
Topic.skip_time_zone_conversion_for_attributes = [:field_a]
Minimalistic.skip_time_zone_conversion_for_attributes = [:field_b]