aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-11-15 04:33:17 +0100
committerXavier Noria <fxn@hashref.com>2012-11-15 04:36:36 +0100
commitbff4d8d165486797227c5933e93a62e7f2c15d98 (patch)
treef71150c5ed14456cad67a6fb7b58430c7555e484 /activesupport/test
parent77edb7cf55d4f0b487bd8e664f6d0725f362745d (diff)
downloadrails-bff4d8d165486797227c5933e93a62e7f2c15d98.tar.gz
rails-bff4d8d165486797227c5933e93a62e7f2c15d98.tar.bz2
rails-bff4d8d165486797227c5933e93a62e7f2c15d98.zip
dependencies no longer trigger Kernel#autoload in remove_const [fixes #8213]
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/autoloading_fixtures/should_not_be_required.rb1
-rw-r--r--activesupport/test/dependencies_test.rb10
2 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/autoloading_fixtures/should_not_be_required.rb b/activesupport/test/autoloading_fixtures/should_not_be_required.rb
new file mode 100644
index 0000000000..1fcf170cc5
--- /dev/null
+++ b/activesupport/test/autoloading_fixtures/should_not_be_required.rb
@@ -0,0 +1 @@
+ShouldNotBeAutoloaded = 0
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 670a04e5df..6e5a6f71e2 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -928,6 +928,16 @@ class DependenciesTest < ActiveSupport::TestCase
assert ! defined?(DeleteMe)
end
+ def test_remove_constant_does_not_trigger_loading_autoloads
+ constant = 'ShouldNotBeAutoloaded'
+ Object.class_eval do
+ autoload constant, File.expand_path('../autoloading_fixtures/should_not_be_required', __FILE__)
+ end
+ ActiveSupport::Dependencies.remove_constant(constant)
+
+ assert Object.autoload?(constant), "Kernel#autoload of #{constant} has been triggered by remove_const"
+ end
+
def test_load_once_constants_should_not_be_unloaded
with_autoloading_fixtures do
ActiveSupport::Dependencies.autoload_once_paths = ActiveSupport::Dependencies.autoload_paths