require "rails/command"
require "rails/test_unit/minitest_plugin"

module Rails
  module Command
    class TestCommand < Base # :nodoc:
      no_commands do
        def help
          perform # Hand over help printing to minitest.
        end
      end

      def perform(*)
        $LOAD_PATH << Rails::Command.root.join("test")

        Minitest.run_via = :rails

        require "active_support/testing/autorun"
      end
    end
  end
end

require "rails/command"
require "rails/test_unit/minitest_plugin"

module Rails
  module Command
    class TestCommand < Base # :nodoc:
      no_commands do
        def help
          perform # Hand over help printing to minitest.
        end
      end

      def perform(*)
        $LOAD_PATH << Rails::Command.root.join("test").to_s

        Minitest.run_via = :rails

        require "active_support/testing/autorun"
      end
    end
  end
end

Add the `<app_root>/test` dir to the `$LOAD_PATH` as a string:
Add the `<app_root>/test` dir to the `$LOAD_PATH` as a string:

- [Rails <= 5.0](https://github.com/rails/rails/blob/5-0-stable/railties/lib/rails/commands/test.rb#L6) used to add the `<app_root>/test` as a string; this behaviour changed in rails 5.1, it's appending a `Pathname` object
