Module: TestRunner

Defined in:
lib/gorgon/worker.rb

Class Method Summary collapse

Class Method Details

.run_file(filename, test_runner) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/gorgon/worker.rb', line 13

def self.run_file filename, test_runner
  start_t = Time.now

  begin
    failures = test_runner.run_file(filename)
    length = Time.now - start_t

    if failures.empty?
      results = {:failures => [], :type => :pass, :runner => test_runner.runner, :time => length}
    else
      results = {:failures => failures, :type => :fail, :runner => test_runner.runner,
        :time => length}
    end
  rescue Exception => e
    results = {:failures => ["Exception: #{e.message}\n#{e.backtrace.join("\n")}"], :type => :crash, :time => (Time.now - start_t)}
  end
  return results
end