Method: ContextValidations::ValidationsFor::MiniTest#determine_constant_from_test_name
- Defined in:
- lib/context_validations/minitest.rb
#determine_constant_from_test_name ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/context_validations/minitest.rb', line 8 def determine_constant_from_test_name names = self.class.name.split('::') while names.size > 0 do names.last.sub!(/Test$/, '') begin constant = names.join('::').constantize break(constant) if constant rescue NameError # Constant wasn't found, move on ensure names.pop end end end |