aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionmailer/test/base_test.rb1
-rw-r--r--activesupport/lib/active_support/json/encoding.rb4
-rw-r--r--activesupport/test/json/encoding_test.rb6
3 files changed, 7 insertions, 4 deletions
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 88e38a583b..5bc0491cff 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -1,5 +1,6 @@
# encoding: utf-8
require 'abstract_unit'
+require 'active_support/time'
class BaseTest < ActiveSupport::TestCase
# TODO Add some tests for implicity layout render and url helpers
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index 3f266d1e96..dbce7e710a 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -9,7 +9,7 @@ require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/object/instance_variables'
-require 'active_support/time'
+require 'time'
module ActiveSupport
class << self
@@ -212,7 +212,7 @@ class Time
if ActiveSupport.use_standard_json_time_format
xmlschema
else
- %(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
+ strftime("%Y/%m/%d %H:%M:%S %z")
end
end
end
diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb
index a8ecf4e4cf..a679efb41e 100644
--- a/activesupport/test/json/encoding_test.rb
+++ b/activesupport/test/json/encoding_test.rb
@@ -1,7 +1,5 @@
# encoding: utf-8
require 'abstract_unit'
-require 'bigdecimal'
-require 'active_support/core_ext/big_decimal/conversions'
require 'active_support/json'
class TestJSONEncoding < Test::Unit::TestCase
@@ -138,6 +136,10 @@ class TestJSONEncoding < Test::Unit::TestCase
ActiveSupport.use_standard_json_time_format = false
end
+ def test_hash_with_time_to_json
+ assert_equal '{"time":"2009/01/01 00:00:00 +0000"}', { :time => Time.utc(2009) }.to_json
+ end
+
def test_nested_hash_with_float
assert_nothing_raised do
hash = {