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

Methods

Public Instance methods

[Source]

    # File lib/autotest/rspec.rb, line 53
53:   def add_options_if_present
54:     File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : ""
55:   end

[Source]

    # File lib/autotest/rspec.rb, line 36
36:   def consolidate_failures(failed)
37:     filters = Hash.new { |h,k| h[k] = [] }
38:     failed.each do |spec, failed_trace|
39:       @files.keys.select{|f| f =~ /spec\//}.each do |f|
40:         if failed_trace =~ Regexp.new(f)
41:           filters[f] << spec
42:           break
43:         end
44:       end
45:     end
46:     return filters
47:   end

[Source]

    # File lib/autotest/rspec.rb, line 25
25:   def handle_results(results)
26:     failed = results.scan(/^\d+\)\n(?:\e\[\d*m)?(?:.*?Error in )?'([^\n]*)'(?: FAILED)?(?:\e\[\d*m)?\n(.*?)\n\n/m)
27:     @files_to_test = consolidate_failures failed
28:     unless @files_to_test.empty? then
29:       hook :red
30:     else
31:       hook :green
32:     end unless $TESTING
33:     @tainted = true unless @files_to_test.empty?
34:   end

[Source]

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

[Source]

    # File lib/autotest/rspec.rb, line 57
57:   def spec_command
58:     spec = File.join(Config::CONFIG['bindir'], 'spec')
59: 
60:     unless File::ALT_SEPARATOR.nil? then
61:       spec.gsub! File::SEPARATOR, File::ALT_SEPARATOR
62:     end
63: 
64:     return spec
65:   end

[Source]

    # File lib/autotest/rspec.rb, line 21
21:   def tests_for_file(filename)
22:     super.select { |f| @files.has_key? f }
23:   end

[Validate]