提交 465f0fbc 编写于 作者: Y Yves Senn

test runner should crash with non existing file argument.

Before this patch, using `bin/rails test` with a non existing
file or directory argument would silently swallow the argument and
run the whole test suite.

After the patch the command fails with `cannot load such file --`.
上级 c402479f
......@@ -18,7 +18,7 @@ def expand_patterns(patterns)
arg = arg.gsub(/:(\d+)?$/, '')
if Dir.exist?(arg)
"#{arg}/**/*_test.rb"
elsif File.file?(arg)
else
arg
end
end
......
......@@ -307,6 +307,11 @@ def test_line_filter_without_line_runs_all_tests
end
end
def test_crash_with_non_existing_file_or_dirname
error = capture(:stderr) { run_test_command('test/nope/niet_test.rb') }
assert_match(%r{cannot load such file.+test/nope/niet_test.rb}, error)
end
def test_shows_filtered_backtrace_by_default
create_backtrace_test
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册