aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-03-16 07:40:11 +0100
committerXavier Noria <fxn@hashref.com>2016-03-16 07:40:11 +0100
commit4efb3608f04c57703016bc65f6081b03362047db (patch)
tree779e4c64875d37b7c1a537d358eb49236bd91dda /activesupport/test
parent52ce6ece8c8f74064bb64e0a0b1ddd83092718e1 (diff)
downloadrails-4efb3608f04c57703016bc65f6081b03362047db.tar.gz
rails-4efb3608f04c57703016bc65f6081b03362047db.tar.bz2
rails-4efb3608f04c57703016bc65f6081b03362047db.zip
adds coverage for raising while autoloading
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb3
-rw-r--r--activesupport/test/dependencies_test.rb9
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