提交 64448c29 编写于 作者: Y Yves Senn

bring back `TEST` env for `rake test`.

Closes #23027.

This does not restore complete backwards compatibility. It simply passes
the contets of the `TEST` env to the new runner.
上级 f718e52b
* Bring back `TEST=` env for `rake test` task.
*Yves Senn*
* Specify log file names or all logs to clear `rake log:clear`
Specify which logs to clear when using the `rake log:clear` task, e.g. `rake log:clear LOGS=test,staging`
......
......@@ -7,7 +7,12 @@ task default: :test
desc "Runs all tests in test folder"
task :test do
$: << "test"
Minitest.rake_run(["test"])
pattern = if ENV.key?('TEST')
ENV['TEST']
else
"test"
end
Minitest.rake_run([pattern])
end
namespace :test do
......
......@@ -450,6 +450,17 @@ def test_raise_error_when_specified_file_does_not_exist
assert_match(%r{cannot load such file.+test/not_exists\.rb}, error)
end
def test_pass_TEST_env_on_rake_test
create_test_file :models, 'account'
create_test_file :models, 'post', pass: false
output = Dir.chdir(app_path) { `bin/rake test TEST=test/models/post_test.rb` }
assert_match "PostTest", output, "passing TEST= should run selected test"
assert_no_match "AccountTest", output, "passing TEST= should only run selected test"
assert_match '1 runs, 1 assertions', output
end
private
def run_test_command(arguments = 'test/unit/test_test.rb')
Dir.chdir(app_path) { `bin/rails t #{arguments}` }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册