提交 ad01b8da 编写于 作者: A Andrew White

Add failing test for #9562

Rails 4.0.0 fails when trying to encode an ActiveSupport::TimeWithZone
that wraps a DateTime instance. This is fixed on master so add a test
to prevent regression.
上级 57e3e0c1
......@@ -80,6 +80,11 @@ def test_to_json_with_use_standard_json_time_format_config_set_to_true
ActiveSupport.use_standard_json_time_format = old
end
def test_to_json_when_wrapping_a_date_time
twz = ActiveSupport::TimeWithZone.new(DateTime.civil(2000), @time_zone)
assert_equal '"1999-12-31T19:00:00.000-05:00"', ActiveSupport::JSON.encode(twz)
end
def test_nsec
local = Time.local(2011,6,7,23,59,59,Rational(999999999, 1000))
with_zone = ActiveSupport::TimeWithZone.new(nil, ActiveSupport::TimeZone["Hawaii"], local)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册