提交 dea3d2dd 编写于 作者: A Aaron Patterson

adding a test for attributes after type cast. thanks nragaz.

上级 cb3e96a4
......@@ -132,6 +132,23 @@ def test_read_attributes_before_type_cast_on_datetime
end
end
def test_read_attributes_after_type_cast_on_datetime
in_time_zone "Pacific Time (US & Canada)" do
record = @target.new
record.written_on = "2011-03-24"
assert_equal "2011-03-24", record.written_on_before_type_cast
assert_equal Time.zone.parse("2011-03-24"), record.written_on
assert_equal ActiveSupport::TimeZone["Pacific Time (US & Canada)"],
record.written_on.time_zone
record.save
record.reload
assert_equal Time.zone.parse("2011-03-24"), record.written_on
end
end
def test_hash_content
topic = Topic.new
topic.content = { "one" => 1, "two" => 2 }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册