From 5d1999547d81edb07c0ce9149023b1bcd5de8a57 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sat, 19 Aug 2017 08:44:37 +0900 Subject: 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. --- activerecord/bin/test | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/bin') 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" -- cgit v1.2.3