Class: Autotest::Rspec

Inherits:
Autotest
  • Object
show all
Defined in:
lib/vendor/plugins/rspec/lib/autotest/rspec.rb

Direct Known Subclasses

RailsRspec

Instance Method Summary collapse

Constructor Details

#initializeRspec

Returns a new instance of Rspec.



22
23
24
25
26
# File 'lib/vendor/plugins/rspec/lib/autotest/rspec.rb', line 22

def initialize
  super
  self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n\n?(.*?(\n\n\(.*?)?)\n\n/m
  self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
end

Instance Method Details

#add_options_if_presentObject

:nodoc:



44
45
46
# File 'lib/vendor/plugins/rspec/lib/autotest/rspec.rb', line 44

def add_options_if_present # :nodoc:
  File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
end

#consolidate_failures(failed) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/vendor/plugins/rspec/lib/autotest/rspec.rb', line 28

def consolidate_failures(failed)
  filters = new_hash_of_arrays
  failed.each do |spec, trace|
    if trace =~ /\n(\.\/)?(.*spec\.rb):[\d]+:/
      filters[$2] << spec
    end
  end
  return filters
end

#make_test_cmd(files_to_test) ⇒ Object



38
39
40
41
42
# File 'lib/vendor/plugins/rspec/lib/autotest/rspec.rb', line 38

def make_test_cmd(files_to_test)
  return '' if files_to_test.empty?
  spec_program = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec'))
  return "#{ruby} #{spec_program} --autospec #{files_to_test.keys.flatten.join(' ')} #{add_options_if_present}"
end