Class: ParallelizedSpecs

Inherits:
Object
  • Object
show all
Defined in:
lib/parallelized_specs.rb,
lib/parallelized_specs/grouper.rb,
lib/parallelized_specs/railtie.rb

Defined Under Namespace

Classes: ExampleRerunFailuresLogger, FailuresFormatter, Grouper, OutcomeBuilder, Railtie, RuntimeLogger, SlowestSpecLogger, SpecErrorCountLogger, SpecErrorLogger, SpecFailuresLogger, SpecLoggerBase, SpecRuntimeLogger, SpecStartFinishLogger, SpecSummaryLogger, TrendingExampleFailures

Constant Summary collapse

VERSION =
File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).strip
SpecLoggerBaseBase =
base

Class Method Summary collapse

Class Method Details

.executableObject



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/parallelized_specs.rb', line 25

def self.executable
  cmd = if File.file?("script/spec")
          "script/spec"
        elsif bundler_enabled?
          cmd = (run("bundle show rspec") =~ %r{/rspec-1[^/]+$} ? "spec" : "rspec")
          "bundle exec #{cmd}"
        else
          %w[spec rspec].detect { |cmd| system "#{cmd} --version > /dev/null 2>&1" }
        end
  cmd or raise("Can't find executables rspec or spec")
end

.run_tests(test_files, process_number, options) ⇒ Object



18
19
20
21
22
23
# File 'lib/parallelized_specs.rb', line 18

def self.run_tests(test_files, process_number, options)
  exe = executable # expensive, so we cache
  version = (exe =~ /\brspec\b/ ? 2 : 1)
  cmd = "#{rspec_1_color if version == 1}#{exe} #{options[:test_options]} #{rspec_2_color if version == 2}#{spec_opts(version)} #{test_files*' '}"
  execute_command(cmd, process_number, options)
end