Class | Autotest::Rspec
In: | lib/autotest/rspec.rb
Parent: | Autotest

### Methods

consolidate_failures make_test_cmd new spec_command spec_commands

### Public Class methods

new()

[Source]

        # File lib/autotest/rspec.rb, line 22
    22:   def initialize
    23:     super
    24:     self.failed_results_re = /^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m
    25:     self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
    26:   end

### Public Instance methods

consolidate_failures(failed)

[Source]

        # File lib/autotest/rspec.rb, line 28
    28:   def consolidate_failures(failed)
    29:     filters = new_hash_of_arrays
    30:     failed.each do |spec, trace|
    31:       if trace =~ /\n(\.\/)?(.*\.rb):[\d]+:\Z?/
    32:         filters[$2] << spec
    33:       end
    34:     end
    35:     return filters
    36:   end

make_test_cmd(files_to_test)

[Source]

        # File lib/autotest/rspec.rb, line 38
    38:   def make_test_cmd(files_to_test)
    39:     return "#{ruby} -S #{spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}"
    40:   end

spec_command(separator=File::ALT_SEPARATOR)

Finds the proper spec command to use. Precendence is set in the lazily-evaluated method spec_commands. Alias + Override that in ~/.autotest to provide a different spec command then the default paths provided.

[Source]

        # File lib/autotest/rspec.rb, line 50
    50:   def spec_command(separator=File::ALT_SEPARATOR)
    51:     unless defined? @spec_command then
    52:       @spec_command = spec_commands.find { |cmd| File.exists? cmd }
    53:
    54:       raise RspecCommandError, "No spec command could be found!" unless @spec_command
    55:
    56:       @spec_command.gsub! File::SEPARATOR, separator if separator
    57:     end
    58:     @spec_command
    59:   end

spec_commands()

Autotest will look for spec commands in the following locations, in this order:

      * bin/spec
      * default spec bin/loader installed in Rubygems

[Source]

        # File lib/autotest/rspec.rb, line 66
    66:   def spec_commands
    67:     [
    68:       File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')),
    69:       File.join(Config::CONFIG['bindir'], 'spec')
    70:     ]
    71:   end

[Validate]