Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.

(cherry picked from commit ad01b8d)
  • Loading branch information...
commit 4d733d2dd4acd7fa8b8d5886f4ec9cac8321f96f 1 parent dabcfc4
@pixeltrix pixeltrix authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 activesupport/test/core_ext/time_with_zone_test.rb
View
5 activesupport/test/core_ext/time_with_zone_test.rb
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.