aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-03-15 23:44:40 +0100
committerXavier Noria <fxn@hashref.com>2016-03-15 23:46:05 +0100
commit52ce6ece8c8f74064bb64e0a0b1ddd83092718e1 (patch)
tree30e02e89d15d66208421e06d881b44ddfce79ef0 /activesupport
parentd54de0808c05c3f7c70dee8ab0111a94c8f90d00 (diff)
downloadrails-52ce6ece8c8f74064bb64e0a0b1ddd83092718e1.tar.gz
rails-52ce6ece8c8f74064bb64e0a0b1ddd83092718e1.tar.bz2
rails-52ce6ece8c8f74064bb64e0a0b1ddd83092718e1.zip
adds coverage for throwing while autoloading
References #24205.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/autoloading_fixtures/throws.rb3
-rw-r--r--activesupport/test/dependencies_test.rb11
2 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/autoloading_fixtures/throws.rb b/activesupport/test/autoloading_fixtures/throws.rb
new file mode 100644
index 0000000000..55ce509410
--- /dev/null
+++ b/activesupport/test/autoloading_fixtures/throws.rb
@@ -0,0 +1,3 @@
+Throws = 1
+
+throw :t
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index b7a5747f1b..1f9f8aebd3 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -269,6 +269,17 @@ class DependenciesTest < ActiveSupport::TestCase
remove_constants(:ModuleFolder)
end
+ def test_throwing_removes_autoloaded_constants
+ with_autoloading_fixtures do
+ catch :t do
+ Throws
+ end
+ assert !Object.const_defined?(:Throws)
+ end
+ ensure
+ remove_constants(:Throws)
+ end
+
def test_doesnt_break_normal_require
path = File.expand_path("../autoloading_fixtures/load_path", __FILE__)
original_path = $:.dup