class Rails::TestUnit::Runner
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/rails/test_unit/runner.rbs class Rails::TestUnit::Runner def attach_before_load_options: (OptionParser opts) -> OptionParser def compose_filter: (Class runnable, nil filter) -> nil def load_tests: (Array[] argv) -> untyped def run: (?Array[] argv) -> false end
def attach_before_load_options(opts)
Experimental RBS support (using type sampling data from the type_fusion
project).
def attach_before_load_options: (OptionParser opts) -> OptionParser
This signature was generated using 3 samples from 1 application.
def attach_before_load_options(opts) opts.on("--warnings", "-w", "Run with Ruby warnings enabled") { } opts.on("-e", "--environment ENV", "Run tests in the ENV environment") { } end
def compose_filter(runnable, filter)
Experimental RBS support (using type sampling data from the type_fusion
project).
def compose_filter: (Class runnable, nil filter) -> nil
This signature was generated using 11 samples from 1 application.
def compose_filter(runnable, filter) if filters.any? { |_, lines| lines.any? } CompositeFilter.new(runnable, filter, filters) else filter end end
def default_test_exclude_glob
def default_test_exclude_glob ENV["DEFAULT_TEST_EXCLUDE"] || "test/{system,dummy}/**/*_test.rb" end
def default_test_glob
def default_test_glob ENV["DEFAULT_TEST"] || "test/**/*_test.rb" end
def extract_filters(argv)
def extract_filters(argv) # Extract absolute and relative paths but skip -n /.*/ regexp filters. argv.filter_map do |path| next unless path_argument?(path) && !regexp_filter?(path) path = path.tr("\\", "/") case when /(:\d+)+$/.match?(path) file, *lines = path.split(":") filters << [ file, lines ] file when Dir.exist?(path) "#{path}/**/*_test.rb" else filters << [ path, [] ] path end end end
def list_tests(argv)
def list_tests(argv) patterns = extract_filters(argv) tests = Rake::FileList[patterns.any? ? patterns : default_test_glob] tests.exclude(default_test_exclude_glob) if patterns.empty? tests end
def load_tests(argv)
Experimental RBS support (using type sampling data from the type_fusion
project).
def load_tests: ( argv) -> untyped
This signature was generated using 2 samples from 1 application.
def load_tests(argv) tests = list_tests(argv) tests.to_a.each { |path| require File.expand_path(path) } end
def parse_options(argv)
def parse_options(argv) # Perform manual parsing and cleanup since option parser raises on unknown options. env_index = argv.index("--environment") || argv.index("-e") if env_index argv.delete_at(env_index) environment = argv.delete_at(env_index).strip end ENV["RAILS_ENV"] = environment || "test" w_index = argv.index("--warnings") || argv.index("-w") $VERBOSE = argv.delete_at(w_index) if w_index end
def path_argument?(arg)
def path_argument?(arg) %r"^[/\\]?\w+[/\\]".match?(arg) end
def rake_run(argv = [])
def rake_run(argv = []) # Ensure the tests run during the Rake Task action, not when the process exits success = system("rails", "test", *argv, *Shellwords.split(ENV["TESTOPTS"] || "")) success || exit(false) end
def regexp_filter?(arg)
def regexp_filter?(arg) arg.start_with?("/") && arg.end_with?("/") end
def run(argv = [])
Experimental RBS support (using type sampling data from the type_fusion
project).
def run: (? argv) -> false
This signature was generated using 2 samples from 1 application.
def run(argv = []) load_tests(argv) require "active_support/testing/autorun" end