Permalink
Browse files

adding a test for YAML round trip

  • Loading branch information...
1 parent c42a7c6 commit 873616c8e79d432d009a7c72a0276d86a40c2327 @tenderlove tenderlove committed Dec 2, 2010
Showing with 9 additions and 0 deletions.
  1. +9 −0 activerecord/test/cases/yaml_serialization_test.rb
@@ -2,10 +2,19 @@
require 'models/topic'
class YamlSerializationTest < ActiveRecord::TestCase
+ fixtures :topics
+
def test_to_yaml_with_time_with_zone_should_not_raise_exception
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 }
end
+
+ def test_roundtrip
+ topic = Topic.first
+ assert topic
+ t = YAML.load YAML.dump topic
+ assert_equal topic, t
+ end
end

0 comments on commit 873616c

Please sign in to comment.