aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/test_unit/runner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/test_unit/runner.rb')
-rw-r--r--railties/lib/rails/test_unit/runner.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/railties/lib/rails/test_unit/runner.rb b/railties/lib/rails/test_unit/runner.rb
index 33ba2788b4..1f3a248bcb 100644
--- a/railties/lib/rails/test_unit/runner.rb
+++ b/railties/lib/rails/test_unit/runner.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "shellwords"
require "method_source"
require "rake/file_list"
@@ -58,7 +60,8 @@ module Rails
private
def extract_filters(argv)
- argv.select { |arg| arg =~ %r{^/?\w+/} }.map do |path|
+ # Extract absolute and relative paths but skip -n /.*/ regexp filters.
+ argv.select { |arg| arg =~ %r%^/?\w+/% && !arg.end_with?("/") }.map do |path|
case
when path =~ /(:\d+)+$/
file, *lines = path.split(":")
@@ -66,11 +69,11 @@ module Rails
file
when Dir.exist?(path)
"#{path}/**/*_test.rb"
- when path !~ /\/$/
+ else
filters << [ path, [] ]
path
end
- end.compact
+ end
end
end
end