rails/activesupport/test/core_ext
Godfrey Chan 64c88fb5d2 Moved all JSON core extensions into core_ext/object/json
TL;DR The primary driver is to remove autoload surprise.

This is related to #12106. (The root cause for that ticket is that
json/add defines Regexp#to_json among others, but here I'll reproduce
the problem without json/add.)

Before:

   >> require 'active_support/core_ext/to_json'
   => true
   >> //.as_json
   NoMethodError: undefined method `as_json' for //:Regexp
     from (irb):3
     from /Users/godfrey/.rvm/rubies/ruby-2.0.0-p195/bin/irb:16:in `<main>'
   >> //.to_json
   => "\"(?-mix:)\""
   >> //.as_json
   => "(?-mix:)"

After:

   >> require 'active_support/core_ext/to_json'
   => true
   >> //.as_json
   => "(?-mix:)"

This is because ActiveSupport::JSON is autoloaded the first time
Object#to_json is called, which causes additional core extentions
(previously defined in active_support/json/encoding.rb) to be loaded.

When someone require 'active_support/core_ext', the expectation is
that it would add certain methods to the core classes NOW. The
previous behaviour causes additional methods to be loaded the first
time you call `to_json`, which could cause nasty surprises and other
unplesant side-effects.

This change moves all core extensions in to core_ext/json. AS::JSON is
still autoloaded on first #to_json call, but since it nolonger
include the core extensions, it should address the aforementioned bug.

*Requiring core_ext/object/to_json now causes a deprecation warnning*
2013-09-13 03:04:10 -07:00
..
class more descriptive NameError's messages for class attributes 2013-04-17 16:12:21 +02:00
module Fix some assert_raise calls containing messages in Active Support 2012-10-28 17:54:24 -02:00
object Moved all JSON core extensions into core_ext/object/json 2013-09-13 03:04:10 -07:00
array_ext_test.rb Remove deprecated Array#uniq_by and Array#uniq_by! 2013-07-01 22:33:42 -03:00
bigdecimal_test.rb Removed unnecessary require 2013-09-10 13:22:30 +05:30
blank_test.rb use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
class_test.rb use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
date_and_time_behavior.rb better document next_week functionaility closes #9568 2013-04-26 09:09:53 +10:00
date_ext_test.rb Merge pull request #10879 from makaroni4/master 2013-07-29 10:25:06 -07:00
date_time_ext_test.rb Merge pull request #10879 from makaroni4/master 2013-07-29 10:25:06 -07:00
deep_dup_test.rb Keep all methods in object/deep_dup 2012-05-06 11:13:15 -07:00
duplicable_test.rb Remove special cases for duplicable? on Class and Module 2012-05-17 03:00:31 -04:00
duration_test.rb Reduce Duration#inspect to a single series of transformations 2013-09-11 15:28:38 +02:00
enumerable_test.rb Further simplify enumerable group_by test 2013-04-04 12:36:17 -03:00
file_test.rb revises a brittle test in Active Support 2012-08-22 23:10:33 +02:00
hash_ext_test.rb Make HashWithIndifferentAccess#select always return the hash. 2013-07-06 15:56:07 +02:00
integer_ext_test.rb Document Integer#ordinal available in PR #2072. 2012-02-04 18:46:19 +05:30
kernel_test.rb Test Kernel#quietly 2013-01-23 13:29:40 +09:00
load_error_test.rb use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
marshal_test.rb Fix typo in DependenciesTestHelpers module name 2013-03-12 10:33:32 +05:30
module_test.rb Only raise DelegationError if it's is the source of the exception 2013-07-11 09:05:32 +01:00
name_error_test.rb use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
numeric_ext_test.rb Fix some typo in method names, variables 2013-05-26 16:27:05 +05:30
object_and_class_ext_test.rb Test try! with a block 2013-01-23 13:29:40 +09:00
range_ext_test.rb Fix some typo in method names, variables 2013-05-26 16:27:05 +05:30
regexp_ext_test.rb use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
string_ext_test.rb Removed unused modules and classes 2013-09-10 16:44:44 +05:30
struct_test.rb backporting Struct#to_h from ruby 2.0 2012-11-13 11:11:11 -08:00
thread_test.rb Skip tests involving $SAFE, it's not supported on Rubinius. 2013-08-21 17:07:45 +02:00
time_ext_test.rb Merge pull request #10879 from makaroni4/master 2013-07-29 10:25:06 -07:00
time_with_zone_test.rb Fix unused variable warning 2013-08-04 07:09:30 +01:00
uri_ext_test.rb Convert URI.parser.parse to URI.parse, and remove ruby 1.8.x code. 2012-01-19 20:27:16 +09:00