aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2016-01-12 19:24:40 +0100
committerYves Senn <yves.senn@gmail.com>2016-01-12 19:26:05 +0100
commit64448c29deb2f7239ac7e21035c05b8793ee1f47 (patch)
tree0d89d57c8fc6e225ad84cd4a333539b8ec755b21 /railties/test
parentf718e52bcce02bc137263ead3a9d9f5df1c42c37 (diff)
downloadrails-64448c29deb2f7239ac7e21035c05b8793ee1f47.tar.gz
rails-64448c29deb2f7239ac7e21035c05b8793ee1f47.tar.bz2
rails-64448c29deb2f7239ac7e21035c05b8793ee1f47.zip
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.
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/application/test_runner_test.rb11
1 files changed, 11 insertions, 0 deletions
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}` }