Sha256: 33b6013897803843968f8ee0b99e999964bfa0179f32386d399cabfbd1fd72d9
Contents?: true
Size: 701 Bytes
Versions: 4
Compression:
Stored size: 701 Bytes
Contents
module ContextValidations module ValidationsFor module MiniTest def validations_for(action) determine_constant_from_test_name.new.validations(action) end 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 end end end MiniTest::Unit::TestCase.send(:include, ContextValidations::ValidationsFor::MiniTest)
Version data entries
4 entries across 4 versions & 1 rubygems