Class: Uberspec::Rspec

Inherits:
Base
  • Object
show all
Defined in:
lib/uberspec/rspec.rb

Direct Known Subclasses

Parallel

Instance Attribute Summary

Attributes inherited from Base

#config, #matches, #notifier, #watchr

Instance Method Summary collapse

Methods inherited from Base

#all_paths, #clear, #find_and_run_match, #initialize, #run, run_all, #run_all, #set_notifier, #start_watching, #system_with_notify, watch

Constructor Details

This class inherits a constructor from Uberspec::Base

Instance Method Details

#all_test_filesObject



8
9
10
# File 'lib/uberspec/rspec.rb', line 8

def all_test_files
  Dir['spec/**/*_spec.rb'] 
end

#commandObject



4
5
6
# File 'lib/uberspec/rspec.rb', line 4

def command
  'spec'
end

#parse_results(result_string) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/uberspec/rspec.rb', line 12

def parse_results(result_string)
  results = result_string.split("\n")
  results = results.last(4).compact.delete_if {|i| i !~ /\S/i }

  time = results[0].match(/\d+\.\d+/)[0].to_f

  stats = results[1].split(', ').map(&:to_i)
  examples = stats[0]
  failed = stats[1]
  pending = stats[2]

  {:time => time, :examples => examples, :failed => failed, :pending => pending}
end