aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2014-01-26 20:32:34 +0000
committerAndrew White <andyw@pixeltrix.co.uk>2014-01-26 21:25:54 +0000
commitef17225173131541f0f5495ea31fc51ea46cb236 (patch)
tree39ab5ced8cd009358aeb4ae9611e47b6d8f76e13 /activesupport/test/core_ext
parent4cfc467594da86090efa63f1852fb82df9458c2b (diff)
downloadrails-ef17225173131541f0f5495ea31fc51ea46cb236.tar.gz
rails-ef17225173131541f0f5495ea31fc51ea46cb236.tar.bz2
rails-ef17225173131541f0f5495ea31fc51ea46cb236.zip
Consolidate JSON encoding tests in one file
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb35
1 files changed, 0 insertions, 35 deletions
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index 4ea8d2bed6..e9bf43667a 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -1,6 +1,5 @@
require 'abstract_unit'
require 'active_support/time'
-require 'active_support/json'
class TimeWithZoneTest < ActiveSupport::TestCase
@@ -66,33 +65,6 @@ class TimeWithZoneTest < ActiveSupport::TestCase
assert_equal 'EDT', ActiveSupport::TimeWithZone.new(Time.utc(2000, 6), @time_zone).zone #dst
end
- def test_to_json_with_use_standard_json_time_format_config_set_to_false
- with_standard_json_time_format(false) do
- assert_equal "\"1999/12/31 19:00:00 -0500\"", ActiveSupport::JSON.encode(@twz)
- end
- end
-
- def test_to_json_with_use_standard_json_time_format_config_set_to_true
- with_standard_json_time_format(true) do
- assert_equal "\"1999-12-31T19:00:00.000-05:00\"", ActiveSupport::JSON.encode(@twz)
- end
- end
-
- def test_to_json_with_custom_subsecond_resolution
- with_standard_json_time_format(true) do
- ActiveSupport::JSON::Encoding.subsecond_fraction_digits = 0
-
- assert_equal "\"1999-12-31T19:00:00-05:00\"", ActiveSupport::JSON.encode(@twz)
- end
- ensure
- ActiveSupport::JSON::Encoding.subsecond_fraction_digits = nil
- 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)
@@ -822,13 +794,6 @@ class TimeWithZoneTest < ActiveSupport::TestCase
ensure
old_tz ? ENV['TZ'] = old_tz : ENV.delete('TZ')
end
-
- def with_standard_json_time_format(boolean = true)
- old, ActiveSupport.use_standard_json_time_format = ActiveSupport.use_standard_json_time_format, boolean
- yield
- ensure
- ActiveSupport.use_standard_json_time_format = old
- end
end
class TimeWithZoneMethodsForTimeAndDateTimeTest < ActiveSupport::TestCase