class ParallelSpecs
def self.executable
def self.executable if File.file?(".bundle/environment.rb") "bundle exec spec" elsif File.file?("script/spec") "script/spec" else "spec" end end
def self.find_tests(root)
def self.find_tests(root) Dir["#{root}**/**/*_spec.rb"] end
def self.run_tests(test_files, process_number, options)
def self.run_tests(test_files, process_number, options) spec_opts = ['spec/parallel_spec.opts', 'spec/spec.opts'].detect{|f| File.file?(f) } spec_opts = (spec_opts ? "-O #{spec_opts}" : nil) color = ($stdout.tty? ? 'export RSPEC_COLOR=1 ;' : '')#display color when we are in a terminal cmd = "export RAILS_ENV=test ; #{color} #{executable} #{options} #{spec_opts} #{test_files*' '}" execute_command(cmd, process_number) end