Class: Autotest::Rspec
Constant Summary collapse
- SPEC_PROGRAM =
File.(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec'))
Instance Method Summary collapse
-
#add_options_if_present ⇒ Object
:nodoc:.
- #consolidate_failures(failed) ⇒ Object
-
#initialize ⇒ Rspec
constructor
A new instance of Rspec.
- #make_test_cmd(files_to_test) ⇒ Object
- #normalize(files_to_test) ⇒ Object
Constructor Details
#initialize ⇒ Rspec
Returns a new instance of Rspec.
23 24 25 26 27 |
# File 'lib/autotest/rspec.rb', line 23 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_present ⇒ Object
:nodoc:
51 52 53 |
# File 'lib/autotest/rspec.rb', line 51 def # :nodoc: File.exist?("spec/spec.opts") ? "-O #{File.join('spec','spec.opts')} " : "" end |
#consolidate_failures(failed) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/autotest/rspec.rb', line 29 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
39 40 41 42 |
# File 'lib/autotest/rspec.rb', line 39 def make_test_cmd(files_to_test) files_to_test.empty? ? '' : "#{ruby} #{SPEC_PROGRAM} --autospec #{normalize(files_to_test).keys.flatten.join(' ')} #{}" end |
#normalize(files_to_test) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/autotest/rspec.rb', line 44 def normalize(files_to_test) files_to_test.keys.inject({}) do |result, filename| result[File.(filename)] = [] result end end |