diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-28 20:27:30 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-09-29 08:37:33 +0200 |
commit | 2310fb9d810f11681c1eecdb88518c23c8b379cf (patch) | |
tree | 969834f7a9f74738c4ad208418372b802b754f66 /railties/test/application | |
parent | 64a3b09b408400c94fd25f22c2ce791a8d90b5cb (diff) | |
download | rails-2310fb9d810f11681c1eecdb88518c23c8b379cf.tar.gz rails-2310fb9d810f11681c1eecdb88518c23c8b379cf.tar.bz2 rails-2310fb9d810f11681c1eecdb88518c23c8b379cf.zip |
Add fail fast to test runner.
Passing `--fail-fast` to the test runner will now abort the test run
on the first failure. The run continues on any unexpected errors.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/test_runner_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index 4e747b5253..acfba21f1c 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -355,6 +355,21 @@ module ApplicationTests assert_match %r{Running:\n\nF\n\nwups!\n\nbin/rails test test/models/post_test.rb:4}, output end + def test_fail_fast + app_file 'test/models/post_test.rb', <<-RUBY + require 'test_helper' + + class PostTest < ActiveSupport::TestCase + def test_post + assert false, 'wups!' + end + end + RUBY + + assert_match(/Interrupt/, + capture(:stderr) { run_test_command('test/models/post_test.rb --fail-fast') }) + end + def test_raise_error_when_specified_file_does_not_exist error = capture(:stderr) { run_test_command('test/not_exists.rb') } assert_match(%r{cannot load such file.+test/not_exists\.rb}, error) |