class Minitest::RerunOptionsReporter

Public Instance Methods

report() click to toggle source
# File lib/minitest/rerun_options_plugin.rb, line 15
def report
  return if results.empty?

  names = results.collect do |result|
    "#{result.class.name}##{result.name}"
  end

  io.puts
  io.puts "Rerun failed tests options:"
  io.puts rerun_options_for(names)
  io.puts
end

Private Instance Methods

multiple_run_option_for(names) click to toggle source
# File lib/minitest/rerun_options_plugin.rb, line 54
def multiple_run_option_for(names)
  "--names #{names.join(',')}"
end
rake_options_for(names) click to toggle source
# File lib/minitest/rerun_options_plugin.rb, line 42
def rake_options_for(names)
  options = names.collect do |name|
    "TEST_OPTS=\"#{single_run_option_for(name)}\""
  end.join("\n")
  options <<  "\nTEST_OPTS=\"#{multiple_run_option_for(names)}\"" if names.length > 1
  options
end
rerun_options_for(names) click to toggle source
# File lib/minitest/rerun_options_plugin.rb, line 30
def rerun_options_for(names)
  $0.include?("rake_test_loader") ? rake_options_for(names) : ruby_options_for(names)
end
ruby_options_for(names) click to toggle source
# File lib/minitest/rerun_options_plugin.rb, line 34
def ruby_options_for(names)
  options = names.collect do |name|
    single_run_option_for(name)
  end.join("\n")
  options << "\n#{multiple_run_option_for(names)}" if names.length > 1
  options
end
single_run_option_for(name) click to toggle source
# File lib/minitest/rerun_options_plugin.rb, line 50
def single_run_option_for(name)
  "--name #{name}"
end