lib/parallel_tests/tasks.rb in parallel_tests-2.22.1 vs lib/parallel_tests/tasks.rb in parallel_tests-2.23.0
- old
+ new
@@ -63,24 +63,25 @@
break
end
end
end
- # parallel:spec[:count, :pattern, :options]
+ # parallel:spec[:count, :pattern, :options, :pass_through]
def parse_args(args)
# order as given by user
- args = [args[:count], args[:pattern], args[:options]]
+ args = [args[:count], args[:pattern], args[:options], args[:pass_through]]
# count given or empty ?
# parallel:spec[2,models,options]
# parallel:spec[,models,options]
count = args.shift if args.first.to_s =~ /^\d*$/
num_processes = count.to_i unless count.to_s.empty?
pattern = args.shift
options = args.shift
+ pass_through = args.shift
- [num_processes, pattern.to_s, options.to_s]
+ [num_processes, pattern.to_s, options.to_s, pass_through.to_s]
end
end
end
end
@@ -150,15 +151,15 @@
ParallelTests::Tasks.run_in_parallel("RAILS_ENV=#{ParallelTests::Tasks.rails_env} rake #{args.command}", args)
end
['test', 'spec', 'features', 'features-spinach'].each do |type|
desc "Run #{type} in parallel with parallel:#{type}[num_cpus]"
- task type, [:count, :pattern, :options] do |t, args|
+ task type, [:count, :pattern, :options, :pass_through] do |t, args|
ParallelTests::Tasks.check_for_pending_migrations
ParallelTests::Tasks.load_lib
- count, pattern, options = ParallelTests::Tasks.parse_args(args)
+ count, pattern, options, pass_through = ParallelTests::Tasks.parse_args(args)
test_framework = {
'spec' => 'rspec',
'test' => 'test',
'features' => 'cucumber',
'features-spinach' => 'spinach',
@@ -171,10 +172,11 @@
executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
command = "#{ParallelTests.with_ruby_binary(Shellwords.escape(executable))} #{type} --type #{test_framework} " \
"-n #{count} " \
"--pattern '#{pattern}' " \
- "--test-options '#{options}'"
+ "--test-options '#{options}' " \
+ "#{pass_through}"
abort unless system(command) # allow to chain tasks e.g. rake parallel:spec parallel:features
end
end
end