Skip to content
This repository
Browse code

Time has it own implementation of xmlschema, now AMo doesn't depend o…

…n TZInfo

[#4979 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit cb321546b7aef33fcf5466b61f79bd9198cd12b5 1 parent f7ba614
Santiago Pastorino authored July 01, 2010 josevalim committed July 02, 2010
1  actionmailer/test/base_test.rb
... ...
@@ -1,5 +1,6 @@
1 1
 # encoding: utf-8
2 2
 require 'abstract_unit'
  3
+require 'active_support/time'
3 4
 
4 5
 class BaseTest < ActiveSupport::TestCase
5 6
   # TODO Add some tests for implicity layout render and url helpers
4  activesupport/lib/active_support/json/encoding.rb
@@ -9,7 +9,7 @@
9 9
 require 'active_support/core_ext/hash/except'
10 10
 require 'active_support/core_ext/hash/slice'
11 11
 require 'active_support/core_ext/object/instance_variables'
12  
-require 'active_support/time'
  12
+require 'time'
13 13
 
14 14
 module ActiveSupport
15 15
   class << self
@@ -212,7 +212,7 @@ def as_json(options = nil) #:nodoc:
212 212
     if ActiveSupport.use_standard_json_time_format
213 213
       xmlschema
214 214
     else
215  
-      %(#{strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)})
  215
+      strftime("%Y/%m/%d %H:%M:%S %z")
216 216
     end
217 217
   end
218 218
 end
6  activesupport/test/json/encoding_test.rb
... ...
@@ -1,7 +1,5 @@
1 1
 # encoding: utf-8
2 2
 require 'abstract_unit'
3  
-require 'bigdecimal'
4  
-require 'active_support/core_ext/big_decimal/conversions'
5 3
 require 'active_support/json'
6 4
 
7 5
 class TestJSONEncoding < Test::Unit::TestCase
@@ -138,6 +136,10 @@ def test_time_to_json_includes_local_offset
138 136
     ActiveSupport.use_standard_json_time_format = false
139 137
   end
140 138
 
  139
+  def test_hash_with_time_to_json
  140
+    assert_equal '{"time":"2009/01/01 00:00:00 +0000"}', { :time => Time.utc(2009) }.to_json
  141
+  end
  142
+
141 143
   def test_nested_hash_with_float
142 144
     assert_nothing_raised do
143 145
       hash = {

0 notes on commit cb32154

Please sign in to comment.
Something went wrong with that request. Please try again.