Module: ActiveSupport::Testing::ConstantLookup::ClassMethods

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/testing/constant_lookup.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#determine_constant_from_test_name(test_name) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activesupport-7.0.4/lib/active_support/testing/constant_lookup.rb', line 36

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("::").safe_constantize
      break(constant) if yield(constant)
    ensure
      names.pop
    end
  end
end