Module: Pico::TestRunner

Extended by:
TestRunner
Included in:
TestRunner
Defined in:
lib/pico/test_runner.rb

Instance Method Summary collapse

Instance Method Details

#load_test_files_in(test_dir) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/pico/test_runner.rb', line 18

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

#run!Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/pico/test_runner.rb', line 5

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