Skip to content

Commit 5d19995

Browse files
committed
Make test runner work with AR test tool
Since rails#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.
1 parent fe595ec commit 5d19995

File tree

1 file changed

+7
-0
lines changed
  • activerecord/bin

1 file changed

+7
-0
lines changed

activerecord/bin/test

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4+
adapter_index = ARGV.index("--adapter") || ARGV.index("-a")
5+
if adapter_index
6+
ARGV.delete_at(adapter_index)
7+
ENV["ARCONN"] = ARGV.delete_at(adapter_index).strip
8+
end
9+
410
COMPONENT_ROOT = File.expand_path("..", __dir__)
511
require_relative "../../tools/test"
612

@@ -17,4 +23,5 @@ module Minitest
1723
end
1824
end
1925

26+
Minitest.load_plugins
2027
Minitest.extensions.unshift "active_record"

0 commit comments

Comments
 (0)