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
48
|
# File 'lib/distributest/test_runner.rb', line 16
def run_rspec_file(file)
capture_output
start_time = Time.now
begin
require 'spec'
rescue LoadError => ex
return ex.to_s
end
output = []
errors = []
profile = []
Spec::Runner.options.instance_variable_set(:@formatters,
[Distributest::Formatter::BasicFormat.new(output, errors, profile)])
Spec::Runner.options.instance_variable_set(:@example_groups, [])
Spec::Runner.options.instance_variable_set(:@files, [file])
Spec::Runner.options.instance_variable_set(:@files_loaded, false)
if file == ""
return nil
else
Spec::Runner.options.run_examples
end
end_time = Time.now
total_time_for_file = end_time - start_time
out, err = captured_output
return output, errors, profile, total_time_for_file, out + err
end
|