diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2013-10-30 10:43:43 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2013-10-30 10:43:43 -0700 |
commit | dae66a0c9733a7fd2ba4357e24b03b386be3e38f (patch) | |
tree | cc37c85d095046fd639a6ff682209d007d3f38b6 /activesupport/test | |
parent | 45318e4010e4f6303ef740bf159d2803c28acc7a (diff) | |
parent | 64c88fb5d2caf3c34742a07394ac68b8377c4936 (diff) | |
download | rails-dae66a0c9733a7fd2ba4357e24b03b386be3e38f.tar.gz rails-dae66a0c9733a7fd2ba4357e24b03b386be3e38f.tar.bz2 rails-dae66a0c9733a7fd2ba4357e24b03b386be3e38f.zip |
Merge pull request #12203 from chancancode/eager_load_json
Eagerload active_support/json/encoding in active_support/core_ext/object/to_json
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/object/json_test.rb | 9 | ||||
-rw-r--r-- | activesupport/test/json/encoding_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/ordered_hash_test.rb | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/object/json_test.rb b/activesupport/test/core_ext/object/json_test.rb new file mode 100644 index 0000000000..d3d31530df --- /dev/null +++ b/activesupport/test/core_ext/object/json_test.rb @@ -0,0 +1,9 @@ +require 'abstract_unit' + +class JsonTest < ActiveSupport::TestCase + # See activesupport/test/json/encoding_test.rb for JSON encoding tests + + def test_deprecated_require_to_json_rb + assert_deprecated { require 'active_support/core_ext/object/to_json' } + end +end diff --git a/activesupport/test/json/encoding_test.rb b/activesupport/test/json/encoding_test.rb index ed1326705c..d549113ff4 100644 --- a/activesupport/test/json/encoding_test.rb +++ b/activesupport/test/json/encoding_test.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +require 'securerandom' require 'abstract_unit' require 'active_support/core_ext/string/inflections' require 'active_support/json' @@ -96,6 +97,13 @@ class TestJSONEncoding < ActiveSupport::TestCase end end + def test_process_status + # There doesn't seem to be a good way to get a handle on a Process::Status object without actually + # creating a child process, hence this to populate $? + system("not_a_real_program_#{SecureRandom.hex}") + assert_equal %({"exitstatus":#{$?.exitstatus},"pid":#{$?.pid}}), ActiveSupport::JSON.encode($?) + end + def test_hash_encoding assert_equal %({\"a\":\"b\"}), ActiveSupport::JSON.encode(:a => :b) assert_equal %({\"a\":1}), ActiveSupport::JSON.encode('a' => 1) diff --git a/activesupport/test/ordered_hash_test.rb b/activesupport/test/ordered_hash_test.rb index c3fe89de4b..0b54026c64 100644 --- a/activesupport/test/ordered_hash_test.rb +++ b/activesupport/test/ordered_hash_test.rb @@ -1,6 +1,6 @@ require 'abstract_unit' require 'active_support/json' -require 'active_support/core_ext/object/to_json' +require 'active_support/core_ext/object/json' require 'active_support/core_ext/hash/indifferent_access' require 'active_support/core_ext/array/extract_options' |