lib/autotest/rspec.rb in rspec-1.0.4 vs lib/autotest/rspec.rb in rspec-1.0.5

- old
+ new

@@ -4,16 +4,19 @@ def initialize # :nodoc: super @spec_command = "spec" @test_mappings = { - %r%^spec/.*rb$% => proc { |filename, _| + %r%^spec/.*\.rb$% => proc { |filename, _| filename }, %r%^lib/(.*)\.rb$% => proc { |_, m| ["spec/#{m[1]}_spec.rb"] }, + %r%^spec/(spec_helper|shared/.*)\.rb$% => proc { + files_matching %r%^spec/.*_spec\.rb$% + }, } end def tests_for_file(filename) super.select { |f| @files.has_key? f } @@ -42,27 +45,23 @@ end return filters end def make_test_cmd(files_to_test) - cmds = [] - full, partial = files_to_test.partition { |k,v| v.empty? } - - unless full.empty? then - files = full.map {|k,v| k}.flatten.join(' ') - cmds << "#{@spec_command} #{add_options_if_present}#{files}" - end - - partial.each do |f, methods| - cmds.push(*methods.map { |meth| - "#{@spec_command} #{add_options_if_present} #{f}" - }) - end - - return cmds.join('; ') + return "#{ruby} -S #{@spec_command} #{add_options_if_present} #{files_to_test.keys.flatten.join(' ')}" end def add_options_if_present File.exist?("spec/spec.opts") ? "-O spec/spec.opts " : "" + end + + def spec_command + spec = File.join(Config::CONFIG['bindir'], 'spec') + + unless File::ALT_SEPARATOR.nil? then + spec.gsub! File::SEPARATOR, File::ALT_SEPARATOR + end + + return spec end end