module Pico module TestRunner extend self def run! Bundler.require :test pid = fork do Pico.shutdown! # For when we're inside pry %w(test spec).each do |test_dir| load_test_files_in test_dir; end Minitest.autorun end _, status = Process.wait2 pid status.exitstatus == 0 end def load_test_files_in(test_dir) path = Pico.application.root.join(test_dir) return unless path.directory? $LOAD_PATH << path Dir[path.join("**/*_#{test_dir}.rb")].each do |test_file| load test_file end end end end