aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-03-16 07:47:28 +0100
committerXavier Noria <fxn@hashref.com>2016-03-16 07:55:54 +0100
commit49f9dce5b9686ffe759239cb3b9fba78deae4fcf (patch)
treeadf5f3f74346e27880f0475f24076b53c242a03e /activesupport/test
parentdcea594e65d8a95a62cd88e25780605ad797eb82 (diff)
downloadrails-49f9dce5b9686ffe759239cb3b9fba78deae4fcf.tar.gz
rails-49f9dce5b9686ffe759239cb3b9fba78deae4fcf.tar.bz2
rails-49f9dce5b9686ffe759239cb3b9fba78deae4fcf.zip
tests the raising/throwing discards the watching stack
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb1
-rw-r--r--activesupport/test/autoloading_fixtures/throws.rb1
-rw-r--r--activesupport/test/dependencies_test.rb10
3 files changed, 8 insertions, 4 deletions
diff --git a/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb b/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb
index f980631883..404ae289c6 100644
--- a/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb
+++ b/activesupport/test/autoloading_fixtures/raises_arbitrary_exception.rb
@@ -1,3 +1,4 @@
RaisesArbitraryException = 1
+A::B # Autoloading recursion, also expected to be watched and discarded.
raise Exception, 'arbitray exception message'
diff --git a/activesupport/test/autoloading_fixtures/throws.rb b/activesupport/test/autoloading_fixtures/throws.rb
index 55ce509410..5e47b9699b 100644
--- a/activesupport/test/autoloading_fixtures/throws.rb
+++ b/activesupport/test/autoloading_fixtures/throws.rb
@@ -1,3 +1,4 @@
Throws = 1
+A::B # Autoloading recursion, expected to be discarded.
throw :t
diff --git a/activesupport/test/dependencies_test.rb b/activesupport/test/dependencies_test.rb
index dd817af2c5..04e7b24d30 100644
--- a/activesupport/test/dependencies_test.rb
+++ b/activesupport/test/dependencies_test.rb
@@ -272,10 +272,11 @@ class DependenciesTest < ActiveSupport::TestCase
def test_raising_discards_autoloaded_constants
with_autoloading_fixtures do
assert_raises(Exception, 'arbitray exception message') { RaisesArbitraryException }
- assert !Object.const_defined?(:RaisesArbitraryException)
+ assert_not defined?(A)
+ assert_not defined?(RaisesArbitraryException)
end
ensure
- remove_constants(:RaisesArbitraryException)
+ remove_constants(:A, :RaisesArbitraryException)
end
def test_throwing_discards_autoloaded_constants
@@ -283,10 +284,11 @@ class DependenciesTest < ActiveSupport::TestCase
catch :t do
Throws
end
- assert !Object.const_defined?(:Throws)
+ assert_not defined?(A)
+ assert_not defined?(Throws)
end
ensure
- remove_constants(:Throws)
+ remove_constants(:A, :Throws)
end
def test_doesnt_break_normal_require