From 52ce6ece8c8f74064bb64e0a0b1ddd83092718e1 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 15 Mar 2016 23:44:40 +0100 Subject: adds coverage for throwing while autoloading References #24205. --- activesupport/test/autoloading_fixtures/throws.rb | 3 +++ activesupport/test/dependencies_test.rb | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 activesupport/test/autoloading_fixtures/throws.rb 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 -- cgit v1.2.3