diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-10-07 22:23:26 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-10-07 22:49:41 +0200 |
commit | da832016bf775a5b1daeec40d642bf6424a3018a (patch) | |
tree | 7ec2656ace86c55ecf5c4c5cbab4d21fdebd7f97 /railties/lib/rails/test_unit | |
parent | 5ddf6df9665c2af2f52593090694327cd9507454 (diff) | |
download | rails-da832016bf775a5b1daeec40d642bf6424a3018a.tar.gz rails-da832016bf775a5b1daeec40d642bf6424a3018a.tar.bz2 rails-da832016bf775a5b1daeec40d642bf6424a3018a.zip |
Hide Minitest's aggregated results if outputting inline.
We'd see the failures and errors reported after the run, which is needless, when we've already
reported them.
Turns:
```
.......................................S....................F
This failed
bin/rails test test/models/bunny_test.rb:14
....
Finished in 0.100886s, 1020.9583 runs/s, 1001.1338 assertions/s.
2) Failure:
BunnyTest#test_something_failing [/Users/kasperhansen/Documents/code/collection_caching_test/test/models/bunny_test.rb:15]:
This failed
103 runs, 101 assertions, 1 failures, 0 errors, 1 skips
You have skipped tests. Run with --verbose for details.
```
Into:
```
...................S.......................................F
This failed
bin/rails test test/models/bunny_test.rb:14
......................
Finished in 0.069910s, 1473.3225 runs/s, 1444.7143 assertions/s.
103 runs, 101 assertions, 1 failures, 0 errors, 1 skips
```
Diffstat (limited to 'railties/lib/rails/test_unit')
-rw-r--r-- | railties/lib/rails/test_unit/minitest_plugin.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/lib/rails/test_unit/minitest_plugin.rb b/railties/lib/rails/test_unit/minitest_plugin.rb index 3a0a58df88..d1ba35a5ec 100644 --- a/railties/lib/rails/test_unit/minitest_plugin.rb +++ b/railties/lib/rails/test_unit/minitest_plugin.rb @@ -3,6 +3,16 @@ require "rails/test_unit/reporter" require "rails/test_unit/test_requirer" module Minitest + mattr_accessor(:hide_aggregated_results) { false } + + module AggregatedResultSuppresion + def aggregated_results + super unless Minitest.hide_aggregated_results + end + end + + SummaryReporter.prepend AggregatedResultSuppresion + def self.plugin_rails_options(opts, options) opts.separator "" opts.separator "Usage: bin/rails test [options] [files or directories]" @@ -38,6 +48,7 @@ module Minitest options[:fail_fast] = true end + options[:output_inline] = true options[:patterns] = opts.order! end @@ -63,6 +74,9 @@ module Minitest Minitest.backtrace_filter = ::Rails.backtrace_cleaner if ::Rails.respond_to?(:backtrace_cleaner) end + # Disable the extra failure output after a run, unless output is deferred. + self.hide_aggregated_results = options[:output_inline] + self.reporter << ::Rails::TestUnitReporter.new(options[:io], options) end |