class Autotest::Rspec
def add_options_if_present # :nodoc:
def add_options_if_present # :nodoc: File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : "" end
def consolidate_failures(failed)
def consolidate_failures(failed) filters = new_hash_of_arrays failed.each do |spec, trace| if trace =~ /\n(\.\/)?(.*spec\.rb):[\d]+:\Z?/ filters[$2] << spec end end return filters end
def initialize
def initialize super self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m end
def make_test_cmd(files_to_test)
def make_test_cmd(files_to_test) return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" end
def spec_command(separator=File::ALT_SEPARATOR)
~/.autotest to provide a different spec command then the default
lazily-evaluated method spec_commands. Alias + Override that in
Finds the proper spec command to use. Precendence is set in the
def spec_command(separator=File::ALT_SEPARATOR) unless defined? @spec_command then @spec_command = spec_commands.find { |cmd| File.exists? cmd } raise RspecCommandError, "No spec command could be found!" unless @spec_command @spec_command.gsub! File::SEPARATOR, separator if separator end @spec_command end
def spec_commands
* bin/spec
locations, in this order:
Autotest will look for spec commands in the following
def spec_commands [ File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')), File.join(Config::CONFIG['bindir'], 'spec') ] end