Sha256: 0f6483a19e5b03f01ce5f309d3dbcedfc9830c9e5ac983b46b945fe857b5c722

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

require File.join(File.dirname(__FILE__), 'parallel_tests')

class ParallelSpecs < ParallelTests
  def self.run_tests(test_files, process_number, options)
    cmd = "#{color} #{executable} #{options} #{spec_opts} #{test_files*' '}"
    execute_command(cmd, process_number)[:stdout]
  end

  def self.executable
    if bundler_enabled?
      "bundle exec spec"
    elsif File.file?("script/spec")
      "script/spec"
    else
      "spec"
    end
  end

  protected

  def self.spec_opts
    opts = ['spec/parallel_spec.opts', 'spec/spec.opts'].detect{|f| File.file?(f) }
    opts ? "-O #{opts}" : nil
  end

  #display color when we are in a terminal
  def self.color
    ($stdout.tty? ? 'RSPEC_COLOR=1 ; export RSPEC_COLOR ;' : '')
  end

  def self.test_suffix
    "_spec.rb"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parallel_tests-0.4.4 lib/parallel_specs.rb
parallel_tests-0.4.3 lib/parallel_specs.rb