提交 88881d2b 编写于 作者: K Kasper Timm Hansen

Don't run all tests when files end in a colon.

If running `bin/rails t test/models/bunny_test.rb:` we'd implicitly run all the
tests in the bunny test. I now highly doubt that people would ever put in a line
filter without a line *and* want that to mean run all tests in that file.

Instead, change regex to require a line digit after the colon, so runs without a
line at the end would fail to require the test file.

This also has the side benefit of breaking requiring a file with many colons:
`bin/rails t test/models/bunny_test.rb:::::::::::::4`

Think this means I've had enough colonoscopy to last me through the year :)
上级 426b3127
...@@ -15,7 +15,7 @@ def require_files(patterns) ...@@ -15,7 +15,7 @@ def require_files(patterns)
private private
def expand_patterns(patterns) def expand_patterns(patterns)
patterns.map do |arg| patterns.map do |arg|
arg = arg.gsub(/(:\d*)+?$/, '') arg = arg.gsub(/(:\d+)+?$/, '')
if Dir.exist?(arg) if Dir.exist?(arg)
"#{arg}/**/*_test.rb" "#{arg}/**/*_test.rb"
else else
......
...@@ -382,14 +382,6 @@ def test_multiple_line_filters ...@@ -382,14 +382,6 @@ def test_multiple_line_filters
end end
end end
def test_line_filter_without_line_runs_all_tests
create_test_file :models, 'account'
run_test_command('test/models/account_test.rb:').tap do |output|
assert_match 'AccountTest', output
end
end
def test_shows_filtered_backtrace_by_default def test_shows_filtered_backtrace_by_default
create_backtrace_test create_backtrace_test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册