Top Level Namespace

Defined Under Namespace

Modules: Turn Classes: String

Constant Summary collapse

Test =
MiniTest

Instance Method Summary collapse

Instance Method Details

#test_load(options = {}) ⇒ Object

Load each test independently to ensure there are no require dependency issues. This is actually a bit redundant as test-solo will also cover these results. So we may deprecate this in the future. This does not generate a test log entry.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/turn/runners/loadrunner.rb', line 8

def test_load(options={})
  options = test_configuration(options)

  tests    = options['tests']
  loadpath = options['loadpath']
  requires = options['requires']
  live     = options['live']
  exclude  = options['exclude']

  files = Dir.multiglob_r(*tests) - Dir.multiglob_r(*exclude)

  return puts("No tests.") if files.empty?

  max   = files.collect{ |f| f.size }.max
  list  = []

  files.each do |f|
    next unless File.file?(f)
    if r = system("ruby -I#{loadpath.join(':')} #{f} > /dev/null 2>&1")
      puts "%-#{max}s  [PASS]" % [f]  #if verbose?
    else
      puts "%-#{max}s  [FAIL]" % [f]  #if verbose?
      list << f
    end
  end

  puts "  #{list.size} Load Failures"

  if verbose?
    unless list.empty?
      puts "\n-- Load Failures --\n"
      list.each do |f|
        print "* "
        system "ruby -I#{loadpath} #{f} 2>&1"
        #puts
      end
      puts
    end
  end
end