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.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/testing/constant_lookup.rb b/activesupport/lib/active_support/testing/constant_lookup.rb
index 52bfeb7179..07d477c0db 100644
--- a/activesupport/lib/active_support/testing/constant_lookup.rb
+++ b/activesupport/lib/active_support/testing/constant_lookup.rb
@@ -36,10 +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 NameError
- # Constant wasn't found, move on
ensure
names.pop
end