Sha256: 12dbe735e6f02079813b62d6dc35846e58f455c7a553cb776c3e1916058ef0ef

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pico-0.1.0 lib/pico/test_runner.rb
pico-0.0.1 lib/pico/test_runner.rb