Extract `list_tests` from `Rails::TestUnit::Runner.load_tests`

This commit has been made for a future change
for Active Record bin/test to run its own database adapter related tests.
This commit is contained in:
Yasuo Honda 2021-08-30 20:20:00 +09:00
parent 061bf3156f
commit 39b305c0b7
1 changed files with 9 additions and 4 deletions

View File

@ -43,10 +43,7 @@ module Rails
end
def load_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 = list_tests(argv)
tests.to_a.each { |path| require File.expand_path(path) }
end
@ -94,6 +91,14 @@ module Rails
def path_argument?(arg)
%r"^[/\\]?\w+[/\\]".match?(arg)
end
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
end
end