Created
October 6, 2014 22:42
-
-
Save jphenow/2639ae1205b8d3ea154a to your computer and use it in GitHub Desktop.
forked Rspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec/core/rake_task' | |
@parallel_limit = 4 | |
files = Dir.glob("spec/**/*_spec.rb") | |
pids = [] | |
@parallel_limit.times do |i| | |
pids << fork do | |
# Run the tests | |
opts = files.each_slice(files.count / @parallel_limit).to_a[i].join(",") | |
puts "Fork #{i} testing #{opts}" | |
RSpec::Core::RakeTask.new("spec#{i}") do |t| | |
t.pattern = opts | |
end | |
Rake::Task["spec#{i}"].execute | |
# Force the fork to end without running at_exit bindings | |
Kernel.exit! | |
end | |
end | |
Process.waitall |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/aaronhumerickhouse/80f06da79de12ec3b4e2