Sha256: e9e982cef934a7dc28e238acd460a34f52e4f1e8fbe9fe980ce99fde72f11746

Contents?: true

Size: 835 Bytes

Versions: 1

Compression:

Stored size: 835 Bytes

Contents

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

class ParallelSpecs < ParallelTests
  def self.run_tests(test_files, process_number, options)
    cmd = "RAILS_ENV=test ; export RAILS_ENV ; #{color} #{executable} #{options} #{spec_opts} #{test_files*' '}"
    execute_command(cmd, process_number)
  end

  def self.executable
    if File.file?(".bundle/environment.rb")
      "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

1 entries across 1 versions & 1 rubygems

Version Path
parallel_tests-0.3.8 lib/parallel_specs.rb