Class: Testowl::RspecRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/testowl/rspec_runner.rb

Instance Method Summary collapse

Instance Method Details

#run(files) ⇒ Object



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

def run(files)
  results = runDirectly(files)
  count_match = /(\d+)\sexamples?,\s(\d+)\sfailures?/.match(results)
  timing_match = /Finished\sin\s([0-9\.]*)\sseconds/.match(results)
  if count_match && timing_match
    test_count = count_match[1].to_i
    fail_count = count_match[2].to_i
    timing = timing_match[1].to_f
    return test_count, fail_count, timing
  else
    raise "Problem interpreting result. Please check the terminal output."
  end
end

#runDirectly(files) ⇒ Object



18
19
20
21
22
# File 'lib/testowl/rspec_runner.rb', line 18

def runDirectly(files)
  results = TestOwl::Teeio.new
  results.run "rspec -c #{files.join(" ")}"
  results.output
end