diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2017-08-19 08:44:37 +0900 |
---|---|---|
committer | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2018-02-04 20:19:46 +0900 |
commit | 5d1999547d81edb07c0ce9149023b1bcd5de8a57 (patch) | |
tree | 088d20746fe0655ae4aa00df9a45a0fa7b7ed4f5 | |
parent | fe595ecf2f76f3d6f27945babd048c3e94af143a (diff) | |
download | rails-5d1999547d81edb07c0ce9149023b1bcd5de8a57.tar.gz rails-5d1999547d81edb07c0ce9149023b1bcd5de8a57.tar.bz2 rails-5d1999547d81edb07c0ce9149023b1bcd5de8a57.zip |
Make test runner work with AR test tool
Since #29572, test runner will be loaded as minitest's plugin.
Therefore, if specify a value in `Minitest.extensions` before the Minitest
initialization process, the extension will not load and the test runner will
not work.
https://github.com/seattlerb/minitest/blob/44eee51ed9716c789c7cea8a90c131cf736b8915/lib/minitest.rb#L86
Also, load processing of adapter is done before minitest option processing,
so set the adapter in the file so that the `-a` option works.
-rwxr-xr-x | activerecord/bin/test | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/bin/test b/activerecord/bin/test index 83c192531e..9ecf27ce67 100755 --- a/activerecord/bin/test +++ b/activerecord/bin/test @@ -1,6 +1,12 @@ #!/usr/bin/env ruby # frozen_string_literal: true +adapter_index = ARGV.index("--adapter") || ARGV.index("-a") +if adapter_index + ARGV.delete_at(adapter_index) + ENV["ARCONN"] = ARGV.delete_at(adapter_index).strip +end + COMPONENT_ROOT = File.expand_path("..", __dir__) require_relative "../../tools/test" @@ -17,4 +23,5 @@ module Minitest end end +Minitest.load_plugins Minitest.extensions.unshift "active_record" |