diff options
-rw-r--r-- | activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb | 3 | ||||
-rw-r--r-- | activesupport/test/dependencies_test.rb | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb b/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb new file mode 100644 index 0000000000..f980631883 --- /dev/null +++ b/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb @@ -0,0 +1,3 @@ +RaisesArbitraryException = 1 + +raise Exception, 'arbitray exception message' diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb index 1f9f8aebd3..efe2c9a498 100644 --- a/activesupport/test/dependencies_test.rb +++ b/activesupport/test/dependencies_test.rb @@ -269,6 +269,15 @@ class DependenciesTest < ActiveSupport::TestCase remove_constants(:ModuleFolder) end + def test_raising_removes_autoloaded_constants + with_autoloading_fixtures do + assert_raises(Exception, 'arbitray exception message') { RaisesArbitraryException } + assert !Object.const_defined?(:RaisesArbitraryException) + end + ensure + remove_constants(:RaisesArbitraryException) + end + def test_throwing_removes_autoloaded_constants with_autoloading_fixtures do catch :t do |