class Module
def infect_with_assertions(pos_prefix, neg_prefix,
def infect_with_assertions(pos_prefix, neg_prefix, skip_re, dont_flip_re = /\c0/, map = {}) MiniTest::Assertions.public_instance_methods(false).sort.each do |meth| meth = meth.to_s new_name = case meth when /^assert/ then meth.sub(/^assert/, pos_prefix.to_s) when /^refute/ then meth.sub(/^refute/, neg_prefix.to_s) end next unless new_name next if new_name =~ skip_re regexp, replacement = map.find { |re, _| new_name =~ re } new_name.sub! regexp, replacement if replacement puts "\n##\n# :method: #{new_name}\n# See MiniTest::Assertions##{meth}" if $0 == __FILE__ infect_an_assertion meth, new_name, new_name =~ dont_flip_re end end