diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2017-07-10 21:13:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 21:13:22 +0200 |
commit | 3fa66935fd65e2d834dcc743bd835afb5b875f7f (patch) | |
tree | 361e00c0c82de24f359bbe5ba32b76d9913c609e /railties/lib/rails/commands/test | |
parent | b6300f3ecc79bff29cf9bb804a30fd92403feac1 (diff) | |
parent | 0d72489b2a08487f71dd4230846c01a5d99ef35f (diff) | |
download | rails-3fa66935fd65e2d834dcc743bd835afb5b875f7f.tar.gz rails-3fa66935fd65e2d834dcc743bd835afb5b875f7f.tar.bz2 rails-3fa66935fd65e2d834dcc743bd835afb5b875f7f.zip |
Merge pull request #29572 from kaspth/test-runner-no-eager-require
Don't eagerly require Rails' minitest plugin.
Diffstat (limited to 'railties/lib/rails/commands/test')
-rw-r--r-- | railties/lib/rails/commands/test/test_command.rb | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/railties/lib/rails/commands/test/test_command.rb b/railties/lib/rails/commands/test/test_command.rb index ca0b6c00fe..5852f51a62 100644 --- a/railties/lib/rails/commands/test/test_command.rb +++ b/railties/lib/rails/commands/test/test_command.rb @@ -1,21 +1,41 @@ require_relative "../../command" -require_relative "../../test_unit/minitest_plugin" +require_relative "../../test_unit/runner" module Rails module Command class TestCommand < Base # :nodoc: no_commands do def help - perform # Hand over help printing to minitest. + require "optparse" + require "minitest/rails_plugin" + + opts = OptionParser.new + opts.banner = "Usage: #{Rails::TestUnitReporter.executable} [options] [files or directories]" + opts.separator "" + opts.separator "You can run a single test by appending a line number to a filename:" + opts.separator "" + opts.separator " #{Rails::TestUnitReporter.executable} test/models/user_test.rb:27" + opts.separator "" + opts.separator "You can run multiple files and directories at the same time:" + opts.separator "" + opts.separator " #{Rails::TestUnitReporter.executable} test/controllers test/integration/login_test.rb" + opts.separator "" + opts.separator "By default test failures and errors are reported inline during a run." + opts.separator "" + + opts.separator "Rails options:" + Rails::TestUnit::Runner.options(opts) + Minitest.plugin_rails_options(opts, {}) + + say opts end end def perform(*) $LOAD_PATH << Rails::Command.root.join("test").to_s - Minitest.run_via = :rails - - require "active_support/testing/autorun" + Rails::TestUnit::Runner.parse_options(ARGV) + Rails::TestUnit::Runner.run(ARGV) end end end |