aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-09-01 14:12:06 +0100
committerXavier Noria <fxn@hashref.com>2010-09-01 22:32:41 +0200
commitf1966337fa744a1c62054120693072ebabe996a8 (patch)
tree4d5625e90ff2126d77e76916b203ff1c6278cb89 /activesupport/test
parent2ce57fd0d9e2c1c1f787a0874f5292d5b2e9e539 (diff)
downloadrails-f1966337fa744a1c62054120693072ebabe996a8.tar.gz
rails-f1966337fa744a1c62054120693072ebabe996a8.tar.bz2
rails-f1966337fa744a1c62054120693072ebabe996a8.zip
Add before_remove_const callback to ActiveSupport::Dependencies.remove_unloadable_constants!
Signed-off-by: Xavier Noria <fxn@hashref.com>
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/dependencies_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index 77b885dc3d..bc7f597f1d 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -574,6 +574,17 @@ class DependenciesTest < Test::Unit::TestCase
end
end
+ def test_unloadable_constants_should_receive_callback
+ Object.const_set :C, Class.new
+ C.unloadable
+ C.expects(:before_remove_const).once
+ assert C.respond_to?(:before_remove_const)
+ ActiveSupport::Dependencies.clear
+ assert !defined?(C)
+ ensure
+ Object.class_eval { remove_const :C } if defined?(C)
+ end
+
def test_new_contants_in_without_constants
assert_equal [], (ActiveSupport::Dependencies.new_constants_in(Object) { })
assert ActiveSupport::Dependencies.constant_watch_stack.all? {|k,v| v.empty? }