module ContextValidations::ValidationsFor::MiniTest
Public Instance Methods
determine_constant_from_test_name()
click to toggle source
# 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
validations_for(action)
click to toggle source
# File lib/context_validations/minitest.rb, line 4 def validations_for(action) determine_constant_from_test_name.new.validations(action) end