class TestLauncher::Frameworks::Minitest::Runner

Public Instance Methods

by_line_number(test_case) click to toggle source
# File lib/test_launcher/frameworks/minitest.rb, line 101
def by_line_number(test_case)
  if test_case.example
    single_example(test_case, exact_match: true)
  else
    single_file(test_case)
  end
end
multiple_examples_same_file(test_cases) click to toggle source
# File lib/test_launcher/frameworks/minitest.rb, line 129
def multiple_examples_same_file(test_cases)
  test_case = test_cases.first
  single_example(test_cases.first)
end
multiple_examples_same_root(test_cases) click to toggle source
# File lib/test_launcher/frameworks/minitest.rb, line 134
def multiple_examples_same_root(test_cases)
  %{cd #{test_cases.first.app_root} && bundle exec ruby -I test -r bundler/setup -e "ARGV.push('--name=/#{test_cases.first.example}/')" #{test_cases.map {|tc| "-r #{tc.file}"}.uniq.join(" ")}}
end
one_or_more_files(test_cases) click to toggle source
# File lib/test_launcher/frameworks/minitest.rb, line 138
def one_or_more_files(test_cases)
  if test_cases.first.spring_enabled?
    %{cd #{test_cases.first.app_root} && #{test_cases.first.file_runner} #{test_cases.map(&:relative_file).uniq.join(" ")}}
  else
    %{cd #{test_cases.first.app_root} && #{test_cases.first.file_runner} #{test_cases.map(&:file).uniq.join(" ")}}
  end
end
single_example(test_case, name: test_case.example, exact_match: false) click to toggle source
# File lib/test_launcher/frameworks/minitest.rb, line 109
def single_example(test_case, name: test_case.example, exact_match: false)
  name_arg =
    if exact_match && name.match(/[^\w]/)
      Shellwords.escape(name)
    elsif !exact_match
      "'/#{name}/'"
    else
      name
    end

  file =
    if test_case.spring_enabled?
      test_case.relative_file
    else
      test_case.file
    end

  %{cd #{test_case.app_root} && #{test_case.example_runner} #{file} --name=#{name_arg}}
end