method
determine_constant_from_test_name
v4.1.8 -
Show latest stable
- Class:
ActiveSupport::Testing::ConstantLookup::ClassMethods
determine_constant_from_test_name(test_name)public
No documentation available.
# File activesupport/lib/active_support/testing/constant_lookup.rb, line 34
def determine_constant_from_test_name(test_name)
names = test_name.split "::"
while names.size > 0 do
names.last.sub!(/Test$/, "")
begin
constant = names.join("::").constantize
break(constant) if yield(constant)
rescue NoMethodError # subclass of NameError
raise
rescue NameError
# Constant wasn't found, move on
ensure
names.pop
end
end
end