aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing/constant_lookup.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/testing/constant_lookup.rb')
-rw-r--r--activesupport/lib/active_support/testing/constant_lookup.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/testing/constant_lookup.rb b/activesupport/lib/active_support/testing/constant_lookup.rb
index 1b2a75c35d..07d477c0db 100644
--- a/activesupport/lib/active_support/testing/constant_lookup.rb
+++ b/activesupport/lib/active_support/testing/constant_lookup.rb
@@ -36,12 +36,8 @@ module ActiveSupport
while names.size > 0 do
names.last.sub!(/Test$/, "")
begin
- constant = names.join("::").constantize
+ constant = names.join("::").safe_constantize
break(constant) if yield(constant)
- rescue NoMethodError # subclass of NameError
- raise
- rescue NameError
- # Constant wasn't found, move on
ensure
names.pop
end