lib/cukeforker/runner.rb in cukeforker-0.2.0 vs lib/cukeforker/runner.rb in cukeforker-0.2.1
- old
+ new
@@ -16,10 +16,11 @@
# :notify => object (or array of objects) implementing the AbstractListener API
# :out => path directory to dump output to (default: current working dir)
# :log => true/false wether or not to log to stdout (default: true)
# :format => Symbol format passed to `cucumber --format` (default: html)
# :extra_args => Array extra arguments passed to cucumber
+ # :delay => Numeric seconds to sleep between each worker is started (default: 0)
#
class Runner
include Observable
@@ -28,11 +29,12 @@
:vnc => false,
:record => false,
:notify => nil,
:out => Dir.pwd,
:log => true,
- :format => :html
+ :format => :html,
+ :delay => 0
}
def self.run(features, opts = {})
create(features, opts).run
end
@@ -43,10 +45,11 @@
max = opts[:max]
format = opts[:format]
out = File.join opts[:out]
listeners = Array(opts[:notify])
extra_args = Array(opts[:extra_args])
+ delay = opts[:delay]
if opts[:log]
listeners << LoggingListener.new
end
@@ -68,10 +71,10 @@
else
listeners << listener
end
end
- queue = WorkerQueue.new max
+ queue = WorkerQueue.new max, delay
features.each do |feature|
queue.add Worker.new(feature, format, out, extra_args)
end
runner = Runner.new queue