From 64448c29deb2f7239ac7e21035c05b8793ee1f47 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Tue, 12 Jan 2016 19:24:40 +0100 Subject: 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. --- railties/test/application/test_runner_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'railties/test/application') diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index ae8a73842c..bb6c6574c5 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -450,6 +450,17 @@ module ApplicationTests 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}` } -- cgit v1.2.3