1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

remove unnessary option setting from test runner

If run the test over the `rake` command, because of the test patterns is passed
via `rake_run` method, do not need to be obtained from the argv.

This probably fixes #24372.
This commit is contained in:
yuuji.yaginuma 2016-04-23 18:22:04 +09:00
parent 8e7715ae31
commit 9fa07095a3
2 changed files with 10 additions and 5 deletions

View file

@ -54,7 +54,7 @@ module Minitest
options[:color] = true
options[:output_inline] = true
options[:patterns] = opts.order!
options[:patterns] = defined?(@rake_patterns) ? @rake_patterns : opts.order!
end
# Running several Rake tasks in a single command would trip up the runner,
@ -73,10 +73,7 @@ module Minitest
ENV["RAILS_ENV"] = options[:environment] || "test"
unless run_with_autorun
patterns = defined?(@rake_patterns) ? @rake_patterns : options[:patterns]
::Rails::TestRequirer.require_files(patterns)
end
::Rails::TestRequirer.require_files(options[:patterns]) unless run_with_autorun
unless options[:full_backtrace] || ENV["BACKTRACE"]
# Plugin can run without Rails loaded, check before filtering.

View file

@ -502,6 +502,14 @@ module ApplicationTests
assert_match '1 runs, 1 assertions', output
end
def test_pass_rake_options
create_test_file :models, 'account'
output = Dir.chdir(app_path) { `bin/rake --rakefile Rakefile --trace=stdout test` }
assert_match '1 runs, 1 assertions', output
assert_match 'Execute test', output
end
def test_rails_db_create_all_restores_db_connection
create_test_file :models, 'account'
output = Dir.chdir(app_path) { `bin/rails db:create:all db:migrate && echo ".tables" | rails dbconsole` }